0
votes

I have two Mule CE instances that have been configured to be stateless. I have a standalone Apache MQ server that an external system publishes to.

Problem: The two Mule instances have the same message flow deployed with a JMS inbound endpoint on the same queue.

My Question: What prevents the two Mule instances from both receiving/processing the message?

2
Is this problem that you are facing currently ? or a question before the landscape is set upNaveen Raj

2 Answers

1
votes

No, only one Mule instance will pick up the message. That's what JMS queues are for. They are designed to deliver the message once and only once. So only one of your Mule nodes will ever pick up the message.

There are more advanced configurations such as selective and exclusive consumers and also JMS topics to publish messages to multiple subscribers.

0
votes

One way to prevent other consumers from picking the message from same queue is to design exclusive consumer. The broker will pick a single MessageConsumer to get all the messages for a queue to ensure ordering.
ref:- http://activemq.apache.org/exclusive-consumer.html
In Mule you can design your inbound JMS connector in following way:-

 <flow name="Consumer3">
   <jms:inbound-endpoint queue="yourqueue%3Fconsumer.exclusive%3Dtrue" connector-ref="Active_MQ" doc:name="JMS"/> <!-- Only this queue will receive message -->
   <logger message="Consumer3  message received :- #[payload]" level="INFO" doc:name="Logger"/>
 </flow>

ref:- How to create exclusive queue consumer in Mule?