• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mule ESB - WMQ - Write message to Topic not Queue  RSS feed

 
Santhosh Kalisamy
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are using...

Java 8, Mule ESB 3.7.2 and IBM WMQ.

I have a requirement to configure Mule WMQ Connector to write message into Topic.

Does anyone know how to do this? if so, please share.

Primary Goal: Design 2 flows. 1 will work as Producer and 2nd would behave as Consumer.
This will help to add one message to WMQ where as Multiple Consumers will receive messages.

Any help is highly appreciated.
 
Santhosh Kalisamy
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have confirmed with Mulesoft and WMQ Connector doesn't support Publish/Subscribe to Queue.

So, alternative solution could be....

Solution

Use a standard JMS connector, pointing to a Spring bean defined Connection Factory.

Procedure

1 - Create a Spring Bean Connection factory



2 - Create a standard JMS connector and point to the Connection Factory defined in the previous step using a connectionFactory-ref attribute


3 - Create Publishers using <jmsutbound-endpoint ...> elements



4 - Create Subscribers using <jms:inbound-endpoint ...> elements



You can use wildcards in the topic name, so you can match more than one node in a topic tree:



In the previous sample, the inbound endpoint is subscribed to any node in the topic tree that starts with TEST. In the provided sample application it will receive messages from both TEST/TOPIC/1 and TEST/TOPIC/2.

Sample Application


Please refer to the attached configuration file.

You must create a properties file named wmq.properties and place it in the classpath. The required properties are as follow:

wmq.hostName
wmq.port
wmq.queueManager
wmq.channel
wmq.username
wmq.password


You should change the topics names to match the ones used in your environment. To run the application as is, ensure that the following topics are created:

TEST/TOPIC/1
TEST/TOPIC/2


To test the application issue the following commands from the prompt (requires curl):

curl -v -X GET http://localhost:8081/input
curl -v -X GET http://localhost:8082/input


You should be able to see an output like:

INFO 2013-07-23 17:40:26,539 [[wmq-topics].Subscriber3.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Received by Subscriber3: TESTING TEST/TOPIC/1
INFO 2013-07-23 17:40:26,539 [[wmq-topics].Subscriber1.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Received by Subscriber1: TESTING TEST/TOPIC/1

INFO 2013-07-23 17:40:36,183 [[wmq-topics].Subscriber3.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Received by Subscriber3: TESTING TEST/TOPIC/2
INFO 2013-07-23 17:40:36,183 [[wmq-topics].Subscriber2.stage1.02] org.mule.api.processor.LoggerMessageProcessor: Received by Subscriber2: TESTING TEST/TOPIC/2

 
Santhosh Kalisamy
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have managed to achieve this with WMQ Connector itself...



WMQ Queue name should be "topic:<TOPIC_NAME>"

I hope, this helps for someone....
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!