4
votes

I'm quite new to camel so excuse me if this is obvious.

We're trying to set up a camel route (in talend esb) which does the following:

  1. receive a Message by JMS
  2. db update
  3. send the message to another system by JMS using request/reply
  4. use the information in the reply to do another db update

This is all in one route. What I have found out is that the route doesn't accept any more Messages in 1. while it is waiting for the reply in 3.

I have tried to use the "asyncConsumer" parameter on the JMS component but that didn't help.

How can I design the route so that it can process a second (and more) Message while it is still waiting for a reply in 3. ?

Thanks, Laci

2

2 Answers

2
votes

The parameter Petter explained will help but you will still block threads. Another approach is to design the integration as two separate routes. In the first route you receive the jms message, update the db and send out the second message.

If you use InOnly on the producer of this route and set a JMSReplyTo as well as preserveMessageQuo=true then camel will send out the message but not wait for a reply.

Then you use a second route that listens on the reply to queue you specified and does the second db update. This way you do not block any threads.

1
votes

Use the concurrentConsumers attribute. It will enable multiple threads to handle your load. Note that you have to specify the number of threads. This can be a bit complex with all options, so be sure to read the Camel JMS documentation properly.

example from("jms:myQueue?concurrentConsumers=10")

You may want to specify concurrentConsumers on the reply queue for the request reply as well: .inOut().to("jms:requestQueue:foo?concurrentConsumers=10")

The last part Requires version 2.10.3 though.