I'm new to spring-batch and I want to use it to implement the following proces:
read: a list of items from webservice process: groups these items write: these groups back to webservice
Example:
Input: transactionID, store, amount 1, FooStore, 2.50 2, BarStore, 19.99 3, FooStore, 12,49 Output: totalsID, store, amount 1, FooStore, 14.99 2, BarStore, 19.99
Is this even possible using spring-batch, am I missing an important step, or does this conflict with the concept of batch processing to such an extent that I should look for a different solution?
I have found a possible solution, that is by using the writeFooter
method,
but that seems silly because I fear I'll lose a lot of the benefits of using spring-batch like the error recovery and memory management. Plus as far as I can see the footer is only supported if the output is written to a file, not send to a webservice.
Write a job with two steps:
ItemWriter.write()
, update a summary tableYou can also try to reach the goal writing a single SQL statement using aggregate function like SUM() and COUNT() then, with a single-step job, read every record generated from custom SQL and write directly to you text file (or webservice).