Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 564
Dhananjay Avatar asked Aug 15 '14 20:08

Dhananjay


People also ask

What is ActiveMQ in Apache Camel?

The ActiveMQ component is an extension to the JMS component and has been pre-configured for using Apache ActiveMQ 5. x (not Artemis). Users of Apache ActiveMQ Artemis should use the JMS component. More documentation. See the JMS component for more documentation and examples.

What is Apache Camel used for?

Apache Camel ™ is a versatile open-source integration framework based on known Enterprise Integration Patterns. Camel empowers you to define routing and mediation rules in a variety of domain-specific languages (DSL, such as Java, XML, Groovy, Kotlin, and YAML).

Is Apache Camel A message queue?

You use a Queue for point-to-point and Topic for a publish-subscribe model. On a Java platform, JMS - Java Messaging Service provides an interface to a messaging server. Apache activeMQ is one such open source JMS provider. Camel does not ship with a JMS provider; however, it can be configured to use activeMQ.

Is Apache Camel JMS?

It uses Spring's JMS support for declarative transactions, including Spring's JmsTemplate for sending and a MessageListenerContainer for consuming. If you are using Apache ActiveMQ, you should prefer the ActiveMQ component as it has been optimized for ActiveMQ.


1 Answers

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.

like image 145
Petter Nordlander Avatar answered Oct 02 '22 16:10

Petter Nordlander