You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Michael Joyner <mi...@gmail.com> on 2018/09/12 13:42:49 UTC

Aggregation to fire endpoint until predicate is satisfied

Hi,

Is there a way for the .aggregate to keep firing until predicate is satisfied?
Like this:
from("direct:database-save")
.log("Fetch 500 records until no more ....")
.aggregate(constant(true), batchAggregationStrategy())
.completionPredicate().simple("${body.get('offset')} != -1")
.completionTimeout(BATCH_TIME_OUT)
.execute("direct:fetchBatchFromAPI") <====== LIKE THIS
.log("All records are fetched ....");

I bascially want to avoid looping when the aggregator has a predicate. I just want to ask if there is a method that I don't know about.
Thank you,
Michael Joyner

Re: Aggregation to fire endpoint until predicate is satisfied

Posted by Onder SEZGIN <on...@gmail.com>.
I would suggest reading by size from your data source and use split and
aggregate together to see the end of batch..

On Wed, Sep 12, 2018 at 4:42 PM Michael Joyner <mi...@gmail.com>
wrote:

> Hi,
>
> Is there a way for the .aggregate to keep firing until predicate is
> satisfied?
> Like this:
> from("direct:database-save")
> .log("Fetch 500 records until no more ....")
> .aggregate(constant(true), batchAggregationStrategy())
> .completionPredicate().simple("${body.get('offset')} != -1")
> .completionTimeout(BATCH_TIME_OUT)
> .execute("direct:fetchBatchFromAPI") <====== LIKE THIS
> .log("All records are fetched ....");
>
> I bascially want to avoid looping when the aggregator has a predicate. I
> just want to ask if there is a method that I don't know about.
> Thank you,
> Michael Joyner
>