Search code examples
apache-camelactivemq-classicwildcardconsumer

Does Apache Camel supports activemq wildcard consumers?


I need a way to consume messages from multiple activemq jms queues.

As per activemq documentation, it supports wildcard consumers

I am using camel as a messaging bus.Is it possible to look at below named queues

aaa.processQueue
bbb.processQueue
ccc.processQueue

By configuring camel route to look at activemq:*.processQueue endpoint?

Also let me know, if there is more cleaner alternative for this.


Solution

  • Yes. It should be doable as Camel is using the OpenWire/JMS client.

    Your options are:

    1. from("activemq:*.processQueue")
    2. from("activemq:aaa.processQueue,bbb.processQueue,ccc.processQueue")
    3. Multiple routes with a sub route for logic:

      from("activemq:aaa.processQueue").to("direct:doProcess");
      from("activemq:bbb.processQueue").to("direct:doProcess");
      from("activemq:ccc.processQueue").to("direct:doProcess");
      
      from("direct:doProcess").whatever..
      

      This way, you can easily turn on/off routes as well as assigning more consumers to one, given you need to have more priority on aaa.processQueue messages than the rest.