Hi, Claus
Yes, unfortunately, aggregation is required for handling the messages. But I
was able to make it work using the .end() approach. Since that may look
confusing to everyone else, I'll give the direct enpoint a go.
I did actually have a "dummy" endpoint in use, much like the direct endpoint
you're suggesting, but it was my own endpoint and it seemed a bit clumsy. I
wasn't aware of the direct endpoint at the time. It looks a lot less like a
kludge :)
Thanks a lot for the quick answer!
Lauri
Claus Ibsen-2 wrote:
>
> Hi
>
> Are you sure you want to use an aggregator?
> When reading it is sounds like you want to do
>
> from A -> B -> choice when (X) -> C
>
> from(EndpointA)
> .to(EndpointB)
> .choice()
> .when(aggregationPredicate).to(EndpointC)
> .end();
>
>
> You can use the "direct" endpoint to link routes together so if you
> have trouble with having aggregator nested
> then just route to a "direct:foo" endpoint and then do a
>
> from("direct:foo").aggreagate...
>
> You can also try adding a .end() in your route to help Camel denote
> the end of the when / choice / aggregate blocks.
>
>
> On Wed, Aug 5, 2009 at 9:27 AM, lauri.siltanen<[email protected]>
> wrote:
>>
>> 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.
>>
>>
>
>
>
> --
> Claus Ibsen
> Apache Camel Committer
>
> Open Source Integration: http://fusesource.com
> Blog: http://davsclaus.blogspot.com/
> Twitter: http://twitter.com/davsclaus
>
>
--
View this message in context:
http://www.nabble.com/Route-definition-with-aggregation-tp24822021p24824055.html
Sent from the Camel - Users mailing list archive at Nabble.com.