Discussion:
Aggregation to fire endpoint until predicate is satisfied
Michael Joyner
2018-09-12 13:42:49 UTC
Permalink
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
Onder SEZGIN
2018-09-15 10:42:36 UTC
Permalink
I would suggest reading by size from your data source and use split and
aggregate together to see the end of batch..
Post by Michael Joyner
Hi,
Is there a way for the .aggregate to keep firing until predicate is satisfied?
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
Loading...