Hi Yash,

Solution to your problem is probably easier than you think. Using
aggregator [1] EIP should solve your issue.

from("jms:Q1").bean(SomeProcessorBean.class).to("jms:Q2");
from("Q2").
  
aggregate().constant(true).completionPredicate(body().isEqualTo("M2")).groupExchanges().
  to("Q3");

Aggregation demonstrated below will collect all messages until it
receive M2 message. After M2 message is received, list of all messages
collected so far (including closing M3 message) will be send as single
exchange to Q3.

You probable would like to aggregate groups of messages according to
some correlation identifier [2]. I use constant(true) in the example
to collect all the messages to a single group, but normally you
correlate on header value or body contents.

Cheers.

[1] http://camel.apache.org/aggregator.html
[2] http://camel.apache.org/correlation-identifier.html

-- 
Henryk Konsek
http://henryk-konsek.blogspot.com

Reply via email to