qingpan
qingpan

Reputation: 426

Spring batch aggregate result from multiple itemwriter

I am using the partitioner to split the data to multiple steps. Each step will do the same work parallel. My problem is after each step completed, I want to aggregate the result from different itemwriter. Like the total successful and failed cnt in the all writer.

Is there some way I can do that in the spring batch ?

Thanks.

Upvotes: 1

Views: 490

Answers (1)

Nenad Bozic
Nenad Bozic

Reputation: 3784

This answer is probably coming too late, but I stumbled upon this so will give answer.

Partitioned step has aggregator and you can add it to partitioned step. You get collection of all step executions and you can collect sums from all steps. From documentation:

Strategy for a aggregating step executions, usually when they are the result of partitioned or remote execution.

Upvotes: 1

Related Questions