Spring Batch is designed to read and process one item at a time, then write the list of all items processed in a chunk. I want my item to be a List<T>
as well, to be thus read and processed, and then write a List<List<T>>
. My data source is a standard Spring JpaRepository<T, ID>
.
My question is whether there are some standard solutions for this "aggregated" approach. I see that there are some, but they don't read from a JpaRepository, like:
- https://github.com/spring-projects/spring-batch/blob/main/spring-batch-samples/src/main/java/org/springframework/batch/sample/domain/multiline/AggregateItemReader.java
- Spring Batch - Item Reader and ItemProcessor with a list
- Spring Batch- how to pass list of multiple items from input to ItemReader, ItemProcessor and ItemWriter
Update:
I'm looking for a solution that would work for a rapidly changing dataset and in a multithreading environment.