You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Vinu Raj <vi...@wipro.com> on 2014/02/04 11:09:37 UTC

aggregationStrategy - passing last value to next aggregate

I am using a custom aggregationStrategy to group time ordered records that
are coming in a file based on timestamp. One aggregation is considered
completed when there is a certain time delay (say more than 2 mins) between
last record and current record. Example

record 1, t1
record 2, t2
record 3, t3
record 4, t4
record 4, t5

Say between t4 and t3 there is lag of 2 minutes. Need this to get separated
as 2 sets. I can only decide aggregation completion on receiving record 4.
Timestamps are pushed as message headers which is used for comparison the
latest record timestamp.

Set 1
-----------
record 1, t1
record 2, t2
record 3, t3

Set2
-----------
record 4, t4
record 4, t5

What is the best way to achieve this.




--
View this message in context: http://camel.465427.n5.nabble.com/aggregationStrategy-passing-last-value-to-next-aggregate-tp5746771.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggregationStrategy - passing last value to next aggregate

Posted by Claus Ibsen <cl...@gmail.com>.
Yes if you use pure in memory, otherwise use a persistent store. You
can still implement any custom logic you want to do in the
confirm/remove callbacks.

On Tue, Feb 4, 2014 at 5:38 PM, Vinu Raj <vi...@wipro.com> wrote:
> In that case there is a chance of loosing "in flight" messages right ?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/aggregationStrategy-passing-last-value-to-next-aggregate-tp5746771p5746802.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Re: aggregationStrategy - passing last value to next aggregate

Posted by Vinu Raj <vi...@wipro.com>.
In that case there is a chance of loosing "in flight" messages right ?



--
View this message in context: http://camel.465427.n5.nabble.com/aggregationStrategy-passing-last-value-to-next-aggregate-tp5746771p5746802.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: aggregationStrategy - passing last value to next aggregate

Posted by Claus Ibsen <cl...@gmail.com>.
You can keep the last value in the custom agg strategy, and when you
start on a new group, you can use that last value.
Its just java code so you can do what you want in there.


On Tue, Feb 4, 2014 at 11:09 AM, Vinu Raj <vi...@wipro.com> wrote:
> I am using a custom aggregationStrategy to group time ordered records that
> are coming in a file based on timestamp. One aggregation is considered
> completed when there is a certain time delay (say more than 2 mins) between
> last record and current record. Example
>
> record 1, t1
> record 2, t2
> record 3, t3
> record 4, t4
> record 4, t5
>
> Say between t4 and t3 there is lag of 2 minutes. Need this to get separated
> as 2 sets. I can only decide aggregation completion on receiving record 4.
> Timestamps are pushed as message headers which is used for comparison the
> latest record timestamp.
>
> Set 1
> -----------
> record 1, t1
> record 2, t2
> record 3, t3
>
> Set2
> -----------
> record 4, t4
> record 4, t5
>
> What is the best way to achieve this.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/aggregationStrategy-passing-last-value-to-next-aggregate-tp5746771.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io