Hi

onCompletion is its own EIP
https://camel.apache.org/manual/oncompletion.html

The onCompletion works on the incoming exchange in the route, and the
aggregator is separated from that incoming exchange, as the output of the
aggregator runs its own "lifecycle", in its own exchange.
So it has no onCompletion.

The route above you show, is that when the split end() then you are
continuing the incoming exchange which has onCompletion.

Its a bit difficult to explain, if you have the CiA2 book then take a look
in the EIP chapter about the aggregator.



On Tue, Nov 8, 2022 at 9:43 AM Reto Peter <reto.pe...@advanceit.ch> wrote:

> Hi all
>
> I am using a Splitter and an Aggregator.
> All of the output are written into the final result. But at the end of the
> Split, I wanted to add something more.
> This is where the 'onCompletion' method inside the Aggregator can be used
> (in my mind, cause that works for scenarios without a Splitter).
>
> But if have the 'onCompletion' method, then the Aggregator does not finish
> his job (cause it probably doesn't know when to stop)
> If I have no 'onCompletion' method, then the Aggregator does finish his
> job and the route does go on
>
> My question is: Why I cannot use the onCompletion method on the
> Aggregator. Cause that Aggregator does the start work and should also do
> the end work of the aggregation. I have used the Aggregator in other
> scenarios (without the Splitter), and there it worked smoothly
>
> Route where it does work, but I needed to call a bean after the end of the
> Splitter.
> from("direct:anything")
>        .to("direct:getSomething")
>        .split(simple("${body}"), new EdiInterchangeAggregator()) // For
> each document
>              .to("direct:prepareSomething")
>              .to("direct:createSomethingMore")
>        .end()
>        .log("CamelSplitSize: ${exchangeProperty.CamelSplitSize} documents")
>        .bean(EDIFinalizer.class, "finalizeInterchange");
>
> So what I want is to implement the onCompletion method on the class
> EdiInterchangeAggregator.
> Is this really not possible?
>
> Regards
> Reto
>


-- 
Claus Ibsen
-----------------
@davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Reply via email to