I am trying to define the best way to execute a step using a cluster. All the implementations that I have seen so far use a request/reply paradigm where the afterStep callback method is used to block the thread until all replies are received. Besides a blocking thread, the loop with a timeout value won't do, especially with a mix of short-running/long-running steps.

What I would envision is an architecture where the step is stuck in the executing part until all "chunks" are processed. Of course it means that another thread, fired by a controller, is able to change the step from executing to success and fire the next step, if any.

Is this a core capability of Spring batch? (i.e. a flow that can be resumed from another thread than the caller). How to deal with a synchronous job launcher in such a case?

Thx