camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve973 <steve...@gmail.com>
Subject Re: Dynamic routing based on collection values
Date Mon, 24 Oct 2016 09:21:36 GMT
Note that you will have to split on the map's entryset, since a map,
itself, is not iterable.  This is probably obvious, but I wanted to mention
it anyway, since splitting requires an iterable to split.

On Mon, Oct 24, 2016 at 5:16 AM, Steve973 <steve973@gmail.com> wrote:

> Have you tried first using splitter, and then using a choice to determine
> the route?  From the example in "Composed Message Processor", they do
> something similar:
>
> // split up the order so individual OrderItems can be validated by the
> appropriate bean
> from("direct:start")
>     .split().body()
>     .choice()
>         .when().method("orderItemHelper", "isWidget")
>             .to("bean:widgetInventory")
>         .otherwise()
>             .to("bean:gadgetInventory")
>     .end()
>     .to("seda:aggregate");
>
> // collect and re-assemble the validated OrderItems into an order again
> from("seda:aggregate")
>     .aggregate(new MyOrderAggregationStrategy()).header("orderId").
> completionTimeout(1000L)
>         .to("mock:result");
>
> Of course, your "when" calls will be different to look at the key values.
>
>
> On Mon, Oct 24, 2016 at 5:03 AM, raghavender.anthwar@gmail.com <
> raghavender.anthwar@gmail.com> wrote:
>
>> I've gone through the document of recipient list and seems it send the
>> same
>> copy of the message to all routes.
>>
>> I'm looking for sending each value of the map to a different router based
>> on
>> the key.
>>
>> Thank you.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.
>> com/Dynamic-routing-based-on-collection-values-tp5789157p5789165.html
>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message