How to create exclusive queue consumer in Mule?

2019-07-16 11:31发布

问题:

In ActiveMQ you configure an exclusive consumer for a queue like:
Queue_Name_Here?consumer.exclusive=true

How to configure an exclusive consumer like above in Mule?

回答1:

You need to URL encode the queue name, as Mule might try to decode the parameters as Mule transport options, which they are not.

<jms:inbound-endpoint queue="Queue_Name_Here%3Fconsumer.exclusive%3Dtrue" 
                      connector-ref="Active_MQ" 
                      doc:name="JMS"/>


回答2:

I was using a jms:activemq-xa-connector for distributed transactions and changed it to a jms:activemq-connector which now works with your URLEncoding solutions. Not sure why distributed transaction connector does not work.

Thanks Petter.