I have a bunch of messages that need to be routed from EndpointA to
EndpointB, always. In addition, sometimes these messages need to be
aggregated to EndpointC. So always to B, sometimes to C.
I have tries to achieve this by the following DSL definition:
from(EndpointA).choice()
.when(aggregationPredicate)
.aggregate(myAggregationCollection).to(EndpointC)
.when(endpointBPredicate)
.to(EndpointB)
.otherwise()
.to(deadLetters);
This does not work due to the fact that to(EndpointC) is of type
AggregationDefinition instead of ChoiceDefinition and therefore cannot be
followed by .when(endpointBPredicate).
The other definition I tried was the following:
from(EndpointA).choice()
.when(aggregationPredicate)
.aggregate(myAggregationCollection).to(EndpointC);
from(EndpointA).choice()
.when(endpointBPredicate)
.to(EndpointB)
.otherwise()
.to(deadLetters);
What happens here is that every other time the messages go to the first
from(EndpointA).choice() and every other time they go to the second
from(EndpointA).choice(). I would like them to go to both.
How do I go about getting the messages to both endpoints when the predicates
return true?
Thanks,
Lauri
--
View this message in context:
http://www.nabble.com/Route-definition-with-aggregation-tp24822021p24822021.html
Sent from the Camel - Users mailing list archive at Nabble.com.