0
votes

I manage a now fairly large Spring Integration application. Recently, we wanted to add a batch job using Spring Batch (rationale: administration, monitoring, scheduling, ability to restart in case of failure anywhere along the way).

Since we have developed a lot of connectors to the company services, we planned to reuse them in the batch, so I have been looking closely at how Spring Batch and Spring Integration work together (among other things: Spring Batch Integration). What we had in mind was to somehow implement Spring Batch tasklets using (already available) Spring Integration components.

I may have missed something fundamental at the Spring core level but I wasn't able to figure out a simple way to "invoke" a Spring Integration endpoint from a Spring Batch tasklet (if we forget complicated plumbing like RMI calls, "remote chunking", "remote partitioning"...)

Did I miss something ?

1

1 Answers

1
votes

This is a very common use case (invoking an integration flow from a batch job/step).

Simply wire an integration gateway into the tasklet.

In recent applications, it's quite common to use the MessagingGateway annotation or the DSL. But, if you're more familiar with XML, then a <gateway/> will work well too.