[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Using same queue multiple times in a circuit

Thanks for your reply ;

I forgot to mention that this circuit represents a workflow : when a message comes from q1, it has to follow the steps in order to avoid data inconsistency.
Your proposition is good if we can do something like :
from(jms:queue:q1).dynamicRouter().method(DynamicRouterTest.class, "nextStep");
  from(direct:p2).process(p2) .to(jms:queue:q1);
  from(direct:p3).process(p3) .to(jms:queue:q1);

which leads to the same problem (that I, actually, dont really understand)..

De : Alex Dettinger
Envoyé le :dimanche 23 septembre 2018 14:56
À : users@xxxxxxxxxxxxxxxx
Objet :Re: Using same queue multiple times in a circuit

Hi Damien,

  from("jms:queue:queue1") reads messages once at a time.
Using from("jms:queue:q1?concurrentConsumers=2") may help but imply
consequences in terms of resources, thread safety, readability...

  In such a situation, I would avoid reusing q1 if possible. For instance,
you may be able to model the whole circuit in the dynamic router and do
something like:

Hope this help,

On Sun, Sep 23, 2018 at 11:59 AM Damien Nicolas <dmn.nicolas@xxxxxxxxx>

> I have several Camel routes defining a "circuit" like this (where `qx` is
> the queue number x, `px` is the processor number x)
>     q1 -> p1 -> q2 -> p2 -> q1 -> p1 -> q3 -> p3 -> (...)
> as
> from("jms:queue:q1).process("p1").dynamicRouter().method(DynamicRouterTest.class,
> "nextStep");
>     from("jms:queue:q2).process("p2").to("jms:queue:q1");
>     from("jms:queue:q3).process("p3").to(...);
> As you can notice, I reuse the queue `q1` (for achitectural purpose), the
> `dynamicrouter` indicate dynamically the destination when a message comes
> from `q1`, but when the message arrives at `p2`, I get a timeout exception
> in this style:
>     2018-09-22 14:21:21,443 [Camel (camel-1) thread #6 -
> JmsConsumer[QueueTest]] WARN
> org.apache.camel.component.jms.EndpointMessageListener  - Execution of JMS
> message listener failed. Caused by: [org.apache.camel.RuntimeCamelException
> - org.apache.camel.ExchangeTimedOutException: The OUT message was not
> received within: 20000 millis due reply message with correlationID:
> ID:373034344443444200000000000000000000000000000000 not received.
> How can I make it works without disabling jms replying?
> --
> Damien NICOLAS