[ 
https://issues.apache.org/activemq/browse/CAMEL-1638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=51847#action_51847
 ] 

Claus Ibsen commented on CAMEL-1638:
------------------------------------

Willem could you explain a bit more?

I would also like the AggregationStrategy to be a single method to implement as 
thats easier for anonym inner classes and also for languages with closure to 
support more nicely.

I agree we have a catch-22 situation.

If we leave it like the old way then we loose that first callback, that
- takes end users by the surprise as if they aggregate 10 exchanges they would 
expect 10 callbacks
- you lose 1 callback and have to deal with the situation how to remedy this by 
eg adding a special "boolean" flag on the exchange that you have
  done your own "i missed the first exchange fixup".

With the new way, we get
- all 10 callbacks is executed and end users is not surprised
- however the first callback have {{null}} for oldExchange

BTW: As a side note I am speculating how to allow a POJO to be 
AggregatorStrategy so we dont have to use Camel API at all. But I will create a 
new ticket for that as well.

> AggregatorStrategy - should also be invoked for the first exchange
> ------------------------------------------------------------------
>
>                 Key: CAMEL-1638
>                 URL: https://issues.apache.org/activemq/browse/CAMEL-1638
>             Project: Apache Camel
>          Issue Type: Improvement
>          Components: camel-core
>    Affects Versions: 2.0-M1, 1.6.1
>            Reporter: Claus Ibsen
>            Assignee: Claus Ibsen
>             Fix For: 2.0.0
>
>
> Using aggregator, splitterl, multicast etc. that supports 
> {{AggregatorStrategy}} all have the flaw that they skip invoking this 
> interface callback for the very first exchange.
> This hazzles the end users implementing this interface if they are to be able 
> to traverse all the exchanges, to eg summing a total amount or the likes.
> And its also a bit confusing as well why the first one is skipped.
> And if you aggregator out of order then you dont know which one was the first 
> exchange.
> So we should invoke this callback always. And the first time the 
> {{oldExchange}} parameter is null.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to