Search code examples
javaspring-batchjsr352jberet

Java Batch restart does not process steps


When restarting the job, NO batchlet is executed, i.e. the process() method of the batchlets isn't called.

Does someone have some hints why restart does not execute any of the batchlets. I've tried nearly every combination but no change to get the restart to work properly.

The restart works as such () doesn't bring an error - BUT terminates successfully without calling any of the batchlets process() methods.

I'm using wildfly-13.0.0.Final with jBeret.

I have a simple java batch job with this jox.xml definition. The called batchlets currently do nothing else than returning the status.

<job id="job" xmlns="http://xmlns.jcp.org/xml/ns/javaee" version="1.0" restartable="true">
    <flow id="processing">
        <step id="download" next="process">
            <batchlet ref="download"/>
        </step>
        <step id="process" next="notify">
            <batchlet ref="process"/>
            <stop on="STOPPED" restart="notify" />
        </step>
        <step id="notify">
            <batchlet ref="noify"/>
            <end on="COMPLETED"/>
        </step>
    </flow>
</job>

The return values of the bachlets are:

  • download ... COMPLETED
  • process ... STOPPED
  • notify ... COMPLETED

When starting this job with jobOperator.start() everything works as expected.

When re-starting the STOPPED job execution with jobOperator.restart() the jobs get executed but NO batchlet is called.

The batchlets look like this

@Named
public class Notify extends AbstractBatchlet {
    @Override
    public String process() throws Exception {
        return BatchStatus.COMPLETED.toString();
    }
    @Override
    public void stop() throws Exception {
    }
}

Solution

  • The restart attribute has notify as the value, which is a step name inside the flow. It could be that during restart, JBeret was looking for a top-level step named notify, which obviously doesn't exist.