You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by dermoritz <ta...@hotmail.com> on 2015/10/06 13:57:42 UTC

aggreagator completion based on correlation key

in my route i want to aggregate exchanges based on a header value (a
processor extracts it from the body and sets the header)

the route looks like this:

from(direct).process(new SetCorrelationHeader).aggregate(header("id"), new
CustomAggregator).completion<What to set here?>.to(mock)

I want to aggregate all messages with same correlation key. How to achieve
this? (i can't make any assumptions about time or size)

Within the processor for each new group the oldExchange==null. So at the
moment i know that the prevoius group is complete the old exchange is sent
out already. 

So how to implement the completion in this case? Probably
eagerCheckCompletion could help - but how?

(i am using camel 2.14.3 - upgrading is no option)



--
View this message in context: http://camel.465427.n5.nabble.com/aggreagator-completion-based-on-correlation-key-tp5772332.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggreagator completion based on correlation key

Posted by dermoritz <ta...@hotmail.com>.
Ok i made some mistakes.

The predicate with eagerCheckCompletion isn't working. It is very hard to
test stuff that uses timeout (e.g. completion) with the debugger :-P

So how to implement completion here? I know that the last group is complete
if the correlation key changed. But where/how to implement?



--
View this message in context: http://camel.465427.n5.nabble.com/aggreagator-completion-based-on-correlation-key-tp5772332p5772339.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggreagator completion based on correlation key

Posted by dermoritz <ta...@hotmail.com>.
thanks,

i did this, but it only works in conjunction with ".eagerCheckCompletion()".
So in my processor that sets the correlation id i store the last id and if
the id changes (the exchange will start a new group) i set an complete
header.

i will give a complete solution here:
http://camel.465427.n5.nabble.com/Problem-with-custom-aggregation-custom-correlation-data-base-rows-td5772324.html



--
View this message in context: http://camel.465427.n5.nabble.com/aggreagator-completion-based-on-correlation-key-tp5772332p5772337.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggreagator completion based on correlation key

Posted by Claus Ibsen <cl...@gmail.com>.
You can use a predicate as completion critereria.

On Tue, Oct 6, 2015 at 1:57 PM, dermoritz <ta...@hotmail.com> wrote:
> in my route i want to aggregate exchanges based on a header value (a
> processor extracts it from the body and sets the header)
>
> the route looks like this:
>
> from(direct).process(new SetCorrelationHeader).aggregate(header("id"), new
> CustomAggregator).completion<What to set here?>.to(mock)
>
> I want to aggregate all messages with same correlation key. How to achieve
> this? (i can't make any assumptions about time or size)
>
> Within the processor for each new group the oldExchange==null. So at the
> moment i know that the prevoius group is complete the old exchange is sent
> out already.
>
> So how to implement the completion in this case? Probably
> eagerCheckCompletion could help - but how?
>
> (i am using camel 2.14.3 - upgrading is no option)
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/aggreagator-completion-based-on-correlation-key-tp5772332.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition:
https://www.manning.com/books/camel-in-action-second-edition