On Tue, Nov 8, 2022 at 12:03 PM Reto Peter <reto.pe...@advanceit.ch> wrote:

> Camel 3.18.3
>
> Yes, I am talking about the onCompletion method of the AggregationStrategy.
> So when I define the Splitter, I do define the AggregationStrategy class,
> and in this class it should be possible that the method onCompletion is
> called.
> But where I can define the options to the AggregationStrategy, I mean the
> completionSize, completionInterval or completionTimeout?
>
>
Ah so these are intended for aggregate only, as the splitter only use the
aggregation strategy to merge the output of the splitter, in case you want
to transform the output.
The interval/size etc is not possible to configure as it does not make
sense, as the size is the number of messages split.

It just happens that the split EIP is reusing parts of the aggregation
strategy.

In v2 the aggregation strategy had sub interfaces for all of that, but now
in v3 with default methods on interfaces its merged into a single interface.


> -----Original Message-----
> From: Claus Ibsen <claus.ib...@gmail.com>
> Sent: Tuesday, 8 November 2022 11:54
> To: users@camel.apache.org
> Subject: Re: Splitter and Aggregater onCompletion
>
> What camel version do you use?
>
> On Tue, Nov 8, 2022 at 11:53 AM Claus Ibsen <claus.ib...@gmail.com> wrote:
>
> > Hi
> >
> > Ah sorry there is both an onCompletion EIP you can use in routes.
> > And then AggregationStrategy with overloaded/default methods for
> > various callbacks.
> >
> >
> >
> > On Tue, Nov 8, 2022 at 11:39 AM Reto Peter <reto.pe...@advanceit.ch>
> > wrote:
> >
> >> Hi Claus
> >>
> >> Thanks, but the Aggregator has its interface AggregationStrategy and
> >> there is the 'onCompletion' method.
> >> And this method is invoked in case of the following route:
> >>
> >> from("direct:processAndAggregate")
> >>         .toD("xslt-saxon:mm/transform-
> -${header.doctype}-to-EDI-XML.xsl")
> >>         .aggregate(header("doctype"), new
> >> EDIMessageToInterchangeAggregatorMM())
> >>                 .forceCompletionOnStop()
> >>                 .to("sql:INSERT something");
> >>
> >> So that means, in this route the onCompletion of the Aggregator is
> >> called cause the entire route is completed?
> >>
> >> -----Original Message-----
> >> From: Claus Ibsen <claus.ib...@gmail.com>
> >> Sent: Tuesday, 8 November 2022 09:50
> >> To: users@camel.apache.org
> >> Subject: Re: Splitter and Aggregater onCompletion
> >>
> >> 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
> >>
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
> >
>
>
> --
> Claus Ibsen
> -----------------
> @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2
>


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

Reply via email to