You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Pointless <po...@yahoo.com> on 2014/08/27 13:44:01 UTC
Request-reply concurrency with jms in older Camel versions
Hello,
I have a problem with concurrently sending messages to InOut jms destination
and processing replies using Camel 2.6.0. I cannot upgrade because of java
1.5. As I undestand, in such case there is only 1 consumer listening for the
replies. I tried using thread dsl, but it didn't help, probably because
there is still only 1 DefaultMessageListenerContainer which listens for the
replies sinchronously and thread dsl creates threads only for processing
those replies afterwards, am I right?
My route:
<camel:route id="esbDirectRoute">
<camel:from uri="direct:esbRoute"/>
<camel:setExchangePattern pattern="InOut" />
<camel:to uri="log:beforeSendingToEsb"/>
<camel:to
uri="jmsIBM:queue:REQ_QUEUE?exchangePattern=InOut&timeToLive=60000&requestTimeout=60000&receiveTimeout=100&concurrentConsumers=20&maxConcurrentConsumers=20"
/>
<camel:threads poolSize="20" maxPoolSize="20" threadName="esb-pool-thread">
<camel:to uri="log:afterSendingToEsb"/>
</camel:threads>
</camel:route>
There are multiple threads calling this route. When testing with only 1
working thread the time between 2 log statemments is 1-2 s (jms provider
system response time). When there are many threads like 10-20 - time between
log statements increases up to 15 s. Here is log showing the start of this
test:
2014-08-27 10:26:22 INFO beforeSendingToEsb
2014-08-27 10:26:22 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:23 INFO beforeSendingToEsb
2014-08-27 10:26:24 INFO afterSendingToEsb
2014-08-27 10:26:24 INFO beforeSendingToEsb
2014-08-27 10:26:25 INFO afterSendingToEsb
2014-08-27 10:26:26 INFO beforeSendingToEsb
2014-08-27 10:26:26 INFO afterSendingToEsb
2014-08-27 10:26:27 INFO beforeSendingToEsb
2014-08-27 10:26:28 INFO afterSendingToEsb
2014-08-27 10:26:28 INFO beforeSendingToEsb
...
Is there any way to use concurrent response listener with Camel 1.6.0? Any
way to control how Camel creates
org.springframework.jms.listener.DefaultMessageListenerContainer or
org.springframework.jms.listener.SimpleMessageListenerContainer in this
case?
Excerpt from camel jms docs:
"Camel will automatic setup a consumer which listen on the reply queue, so
you should not do anything.
This consumer is a Spring DefaultMessageListenerContainer which listen for
replies. However it's fixed to 1 concurrent consumer.
That means replies will be processed in sequence as there are only 1 thread
to process the replies. If you want to process replies faster, then we need
to use concurrency. But not using the concurrentConsumer option. We should
use the threads from the Camel DSL instead"
Seems that this issue is addressed in Camel 2.10.3:
"Allows to process reply messages concurrently using concurrent message
listeners in use. You can specify a range using the concurrentConsumers and
maxConcurrentConsumers options. Notice: That using Shared reply queues may
not work as well with concurrent listeners, so use this option with care."
Thank you,
Igor
--
View this message in context: http://camel.465427.n5.nabble.com/Request-reply-concurrency-with-jms-in-older-Camel-versions-tp5755769.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Request-reply concurrency with jms in older Camel versions
Posted by Pointless <po...@yahoo.com>.
I made a new test with delaying jms provider system responses by 20s, and
seems that responses are being processed cuncurrently, probably because I
have multiple consumer threads calling direct route:
Case 1: Jms (InOnly, maxConsumers=10) -> Split (pool of 10-20 threads) ->
Custom component/endpoint/producer with parent (referenced)
endpoint/producer set as Direct route -> Direct InOut route -> Jms (InOut,
maxConsumers=10), or
Case 2: Jms (InOnly, maxConsumers=10) -> Split (pool of 10-20 threads) ->
Custom component/endpoint/producer with parent (referenced)
endpoint/producer set as Jms endpoint -> Jms (InOut, maxConsumers=10)
Here are logs for the second case, logging is done inside custom producer
around going into parent producer (jms) and receiving responses (responses
from provider system delayed for 20s).
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer42.Camel (process) thread #5 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer41.Camel (process) thread #4 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer47.Camel (process) thread #10 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer38.Camel (process) thread #1 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer43.Camel (process) thread #6 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer39.Camel (process) thread #2 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer40.Camel (process) thread #3 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer44.Camel (process) thread #7 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer46.Camel (process) thread #9 - Split
2014-08-28 10:14:09 INFO EsbRedeliveryProducer: before
parentProducer45.Camel (process) thread #8 - Split
2014-08-28 10:14:33 INFO EsbRedeliveryProducer: after
parentProducer40.Camel (process) thread #3 - Split
2014-08-28 10:14:33 INFO EsbRedeliveryProducer: after
parentProducer42.Camel (process) thread #5 - Split
2014-08-28 10:14:33 INFO EsbRedeliveryProducer: after
parentProducer38.Camel (process) thread #1 - Split
2014-08-28 10:14:33 INFO EsbRedeliveryProducer: before
parentProducer40.Camel (process) thread #3 - Split
2014-08-28 10:14:34 INFO EsbRedeliveryProducer: before
parentProducer42.Camel (process) thread #5 - Split
2014-08-28 10:14:34 INFO EsbRedeliveryProducer: after
parentProducer46.Camel (process) thread #9 - Split
2014-08-28 10:14:36 INFO EsbRedeliveryProducer: after
parentProducer44.Camel (process) thread #7 - Split
2014-08-28 10:14:37 INFO EsbRedeliveryProducer: after
parentProducer41.Camel (process) thread #4 - Split
2014-08-28 10:14:37 INFO EsbRedeliveryProducer: before
parentProducer38.Camel (process) thread #1 - Split
2014-08-28 10:14:38 INFO EsbRedeliveryProducer: after
parentProducer43.Camel (process) thread #6 - Split
2014-08-28 10:14:39 INFO EsbRedeliveryProducer: after
parentProducer45.Camel (process) thread #8 - Split
2014-08-28 10:14:41 INFO EsbRedeliveryProducer: after
parentProducer39.Camel (process) thread #2 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: after
parentProducer47.Camel (process) thread #10 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer46.Camel (process) thread #9 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer43.Camel (process) thread #6 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer39.Camel (process) thread #2 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer41.Camel (process) thread #4 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer45.Camel (process) thread #8 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer44.Camel (process) thread #7 - Split
2014-08-28 10:14:42 INFO EsbRedeliveryProducer: before
parentProducer47.Camel (process) thread #10 - Split
2014-08-28 10:14:55 INFO EsbRedeliveryProducer: after
parentProducer40.Camel (process) thread #3 - Split
2014-08-28 10:14:55 INFO EsbRedeliveryProducer: before
parentProducer40.Camel (process) thread #3 - Split
2014-08-28 10:14:56 INFO EsbRedeliveryProducer: after
parentProducer42.Camel (process) thread #5 - Split
2014-08-28 10:14:56 INFO EsbRedeliveryProducer: before
parentProducer42.Camel (process) thread #5 - Split
2014-08-28 10:14:58 INFO EsbRedeliveryProducer: after
parentProducer38.Camel (process) thread #1 - Split
2014-08-28 10:14:59 INFO EsbRedeliveryProducer: before
parentProducer38.Camel (process) thread #1 - Split
2014-08-28 10:15:04 INFO EsbRedeliveryProducer: after
parentProducer46.Camel (process) thread #9 - Split
2014-08-28 10:15:04 INFO EsbRedeliveryProducer: before
parentProducer46.Camel (process) thread #9 - Split
2014-08-28 10:15:05 INFO EsbRedeliveryProducer: after
parentProducer44.Camel (process) thread #7 - Split
2014-08-28 10:15:05 INFO EsbRedeliveryProducer: before
parentProducer44.Camel (process) thread #7 - Split
2014-08-28 10:15:06 INFO EsbRedeliveryProducer: after
parentProducer43.Camel (process) thread #6 - Split
2014-08-28 10:15:07 INFO EsbRedeliveryProducer: after
parentProducer39.Camel (process) thread #2 - Split
2014-08-28 10:15:09 INFO EsbRedeliveryProducer: after
parentProducer41.Camel (process) thread #4 - Split
2014-08-28 10:15:09 INFO EsbRedeliveryProducer: before
parentProducer43.Camel (process) thread #6 - Split
2014-08-28 10:15:09 INFO EsbRedeliveryProducer: before
parentProducer39.Camel (process) thread #2 - Split
2014-08-28 10:15:13 INFO EsbRedeliveryProducer: after
parentProducer45.Camel (process) thread #8 - Split
2014-08-28 10:15:13 INFO EsbRedeliveryProducer: after
parentProducer47.Camel (process) thread #10 - Split
So, seems that it was my fault not to see this.
--
View this message in context: http://camel.465427.n5.nabble.com/Request-reply-concurrency-with-jms-in-older-Camel-versions-tp5755769p5755806.html
Sent from the Camel - Users mailing list archive at Nabble.com.