Hello gentlemen, 

Please, how to implement *producer-consumer problem* (bounded-buffer) in
Camel. One route puts exchanges to shared queue (e.g on user request).
Second route processes exchanges from shared queue *one by one*. The first
route doesn't wait for exchange processing completion.

from("direct:handleUserRequest")
    .to("seda:requests?waitForTaskToComplete=Never")
    .setBody().constant("Your request is being processed."); // User gets a
response immediately

from("seda:requests?concurrentConsumers=1").to("direct:processRequest");

from("direct:processRequest")
     // Long running operation, notify user via email when completed
    .......................

The setting only 'waitForTaskToComplete=Never' allows to process multiple
user requests in time. The setting 'concurrentConsumers=1' blocks
'handleUserRequest' route.








--
View this message in context: 
http://camel.465427.n5.nabble.com/Producer-consumer-problem-tp5774608.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to