You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dtauzell <da...@tauzell.org> on 2013/03/29 15:12:04 UTC

Splitter, Aggregation and Timeouts

I have a use case like:

1. Message comes in
2. Send modified version of message to one of many recipients
3. Aggregate the responses 

I want to have a timeout on the aggregation of responses.   If one of the
recipients takes to long to respond I'll note that in the aggregated
response and then discard the response when/if it ever comes back.  I don't
need to aggregated responses in any special order.

I thought I could do something like:

split().
  aggregationStrategy(MyAggregationStrategy).
  parallelProcessing().
  streaming().
  timeout(10000).
    to("next route").
end()

 ...

What I would like is that the aggregator gets all the routes that finish in
the 10 second limit and also to know about the routes that didn't finish. 
It needs to take those into account into the final output.

I created a TimeoutAwareAggregationStrategy but I'm not sure how to use the
api to do what I want.

Any suggestions?

Thanks,
   Dave


  



--
View this message in context: http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter, Aggregation and Timeouts

Posted by Raul Kripalani <ra...@evosent.com>.
Take a look at the "Using a Pojo to do the splitting" section in the Split
EIP docs.

I can't give you a deep link now, sorry.

Regards,
Raúl.
On 5 Apr 2013 01:14, "Raul Kripalani" <ra...@evosent.com> wrote:

> Then you're really after a split pattern rather than a multicast.
>
> Create a bean that does the lookup and returns a List of ids.
>
> Then plug it into the split EIP with:
>
> .split(method(MyBean.class)).
>
> The splitter will process each List element individually.
>
> Regards,
> Raúl.
> Thanks,
>
> Is there a way to have the multicast send some sort of parameter to the
> direct endpoints so they can all act slightly differently based on that?
>
> Based on the incoming message I will look up N "member ids".  Each of those
> ids will result in a message being sent to an external web service.  Those
> message will all be different based on configuration data assoicated with
> the "member ids".
>
> -Dave
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730282.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Splitter, Aggregation and Timeouts

Posted by Raul Kripalani <ra...@evosent.com>.
Then you're really after a split pattern rather than a multicast.

Create a bean that does the lookup and returns a List of ids.

Then plug it into the split EIP with:

.split(method(MyBean.class)).

The splitter will process each List element individually.

Regards,
Raúl.
Thanks,

Is there a way to have the multicast send some sort of parameter to the
direct endpoints so they can all act slightly differently based on that?

Based on the incoming message I will look up N "member ids".  Each of those
ids will result in a message being sent to an external web service.  Those
message will all be different based on configuration data assoicated with
the "member ids".

-Dave



--
View this message in context:
http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730282.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter, Aggregation and Timeouts

Posted by dtauzell <da...@tauzell.org>.
Thanks,

Is there a way to have the multicast send some sort of parameter to the
direct endpoints so they can all act slightly differently based on that?  

Based on the incoming message I will look up N "member ids".  Each of those
ids will result in a message being sent to an external web service.  Those
message will all be different based on configuration data assoicated with
the "member ids".

-Dave



--
View this message in context: http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730282.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter, Aggregation and Timeouts

Posted by Raul Kripalani <ra...@evosent.com>.
Yes. The multicast can send to a direct endpoint, which does the
transformation and then dispatches to the final destination.

Another technique is to use the onPrepare option of the multicast DSL. But
this applies better when the same transformation logic is to be applied to
each and every target of the multicast.

Raúl.
On 29 Mar 2013 19:04, "dtauzell" <da...@tauzell.org> wrote:

> Does "multicast" let me change or add data to the exchanges that are sent
> out?  My understanding was that it sends the same message out multiple
> times.
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730099.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Splitter, Aggregation and Timeouts

Posted by dtauzell <da...@tauzell.org>.
Does "multicast" let me change or add data to the exchanges that are sent
out?  My understanding was that it sends the same message out multiple
times.



--
View this message in context: http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087p5730099.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitter, Aggregation and Timeouts

Posted by Christian Müller <ch...@gmail.com>.
No answer for your question, but you are looking for multicast() and not
for split().

Sent from a mobile device
Am 29.03.2013 15:25 schrieb "dtauzell" <da...@tauzell.org>:

> I have a use case like:
>
> 1. Message comes in
> 2. Send modified version of message to one of many recipients
> 3. Aggregate the responses
>
> I want to have a timeout on the aggregation of responses.   If one of the
> recipients takes to long to respond I'll note that in the aggregated
> response and then discard the response when/if it ever comes back.  I don't
> need to aggregated responses in any special order.
>
> I thought I could do something like:
>
> split().
>   aggregationStrategy(MyAggregationStrategy).
>   parallelProcessing().
>   streaming().
>   timeout(10000).
>     to("next route").
> end()
>
>  ...
>
> What I would like is that the aggregator gets all the routes that finish in
> the 10 second limit and also to know about the routes that didn't finish.
> It needs to take those into account into the final output.
>
> I created a TimeoutAwareAggregationStrategy but I'm not sure how to use the
> api to do what I want.
>
> Any suggestions?
>
> Thanks,
>    Dave
>
>
>
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Splitter-Aggregation-and-Timeouts-tp5730087.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>