I am having a task where I am processing items by Spring Batch. Reading items from database and using chunks with commit-interval set to 1000. But after each chunk I need to send a notification to another system with the information about the processed chunk (i.e. some information about each item in one message).
I was thinking about using ChunkListener.afterChunk but I think the problem is with passing IDs of 1000 items to step context / job parameters. Also I could think of some performance issues as each item must be again read from database by its ID (I would avoid IN clause for a thousand IDs).
Does anyone have a hint how this could be solved? Is there some easy way of passing chunk items/ids? Or is Spring Batch suitable for this type of functionality?