You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by BlackTie <jt...@hotmail.com> on 2014/05/16 23:47:28 UTC

What is the best way to make a ProducerTemplate block on a condition?

Given that certain clients may want to make asynchronous requests or
synchronous requests that return after a certain condition is met, and
assuming that an initial request can result in many exchanges being
processed over multiple routes, what is the best way to make the method
using the producer template wait until the condition is met?

One way I'm thinking of implementing it is to send the initial request with
producerTemplate.sendBody(), then have a consumer template listening to a
topic that has status messages sent to it when different parts of the
request processing have completed.  This topic would be used to broadcast
status messages from all requests, so the consumer would use message
selectors to make sure it only received messages it cared about.

I'm not sure if this will work, given that it looks like the
consumerTemplate's receive method returns after it gets the first message. 
Status messages regarding the initial request may come in quickly and I want
to make sure that the one its waiting for isn't missed while it's evaluating
another status message.





--
View this message in context: http://camel.465427.n5.nabble.com/What-is-the-best-way-to-make-a-ProducerTemplate-block-on-a-condition-tp5751238.html
Sent from the Camel - Users mailing list archive at Nabble.com.