Spring Batch and Spring Integration
Typically, a batch application can be triggered via a command-line interface or programmatically, for example, from a web container. Let's introduce Spring Integration and see the possibilities:
- It can be triggered on an event, for example, a file adapter listening for a file triggers Spring Integration on arrival of the file.
- Execution can be chained in a flow—trigger the job, pass on the result, invoke the error path, and so on.
- The message queue is not meant for huge amounts of data. So for big files, Spring Integration can act as the trigger, while delegating the actual task to Spring Batch. It can provide a strategy to chunk the files and distribute them across the Spring Batch job.
- Spring Integration not only triggers batch jobs, but can also collect the result and propagate it in the system. For example, a batch process triggered by Spring Integration may finish off in a day, after which
ItemWriter
can write an item to JMS on which the...