You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by psheehan <PS...@decaresystems.ie> on 2008/03/07 15:04:39 UTC

AggregationCollection implementation

Currently I'm working on a few different prototypes for a large project and
Camel is been used in one of these prototypes.  

Is there anyway in Camel (1.3.0RC2) to provide you own implementation for a
AggregationCollection?  I've created an AggregationStrategy  that is backed
by a persisted collection based off the same correlation id used by the
aggregator.  I've tested this for fail over and all is working fine except
for when a crash occurs before I receive the last message or after I receive
the first message.  When the last message is received after a crash then my
AggregationStrategy is never called because oldExchange is on longer in
memory:-

        if (oldExchange != null) {
            newExchange = aggregationStrategy.aggregate(oldExchange,
newExchange);
        }

Likewise my first message is never persisted because the oldExchange was
never in memory!  (Note that i'm not acually persisting the full message
just the parts of the body I need).

In fact you could agure that AggregationCollection is doing to much work in
keeping onto the old message.



-- 
View this message in context: http://www.nabble.com/AggregationCollection-implementation-tp15891263s22882p15891263.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Re: AggregationCollection implementation

Posted by James Strachan <ja...@gmail.com>.
On 07/03/2008, psheehan <PS...@decaresystems.ie> wrote:
>
>  Currently I'm working on a few different prototypes for a large project and
>  Camel is been used in one of these prototypes.

Great stuff


>  Is there anyway in Camel (1.3.0RC2) to provide you own implementation for a
>  AggregationCollection?

Not currently. So as a workaround you can kinda short-cut the DSL a bit...

from(something).process(new Aggregator(myAggregatorCollection)).to(something);

Though its a bit smelly ;) we need a cleaner way.

So I've just patched the code so that you can do

from(something).aggregator(myAggregatorCollection).to(something).

Hopefully that can sneak into the full 1.3.0 release...



> I've created an AggregationStrategy  that is backed
>  by a persisted collection based off the same correlation id used by the
>  aggregator.

Great stuff!

Fancy submitting it by any chance? We love contributions...
http://activemq.apache.org/camel/contributing.html

We've a pending JIRA on this...
https://issues.apache.org/activemq/browse/CAMEL-217


>  I've tested this for fail over and all is working fine except
>  for when a crash occurs before I receive the last message or after I receive
>  the first message.



> When the last message is received after a crash then my
>  AggregationStrategy is never called because oldExchange is on longer in
>  memory:-
>
>         if (oldExchange != null) {
>             newExchange = aggregationStrategy.aggregate(oldExchange,
>  newExchange);
>         }
>
>  Likewise my first message is never persisted because the oldExchange was
>  never in memory!  (Note that i'm not acually persisting the full message
>  just the parts of the body I need).
>
>  In fact you could agure that AggregationCollection is doing to much work in
>  keeping onto the old message.

Wanna submit the code and we can try fix it up together? Am a tad
confused why this isn't working; as shouldn't it always persist some
message?

-- 
James
-------
http://macstrac.blogspot.com/

Open Source Integration
http://open.iona.com