Q:

Java EE 7 batch API (JSR-352): it's possible to stop a single step and not all the job? 

Note: JSR-352, Java EE, on wildfly 17.0.1, no spring
I have defined the following job in xml:
<? xml version="1.0" encoding="UTF-8"? >
<job id="xml2json" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/jobXML_1_0.xsd" version="1.0">
    <flow id="flow">
        <step id="step1" next="step2">
            <batchlet ref="xmlRead">
            </batchlet>
        </step>
        <step id="step2">
            <batchlet ref="notificationBatchlet">
            </batchlet>        
        </step>
    </flow>
</job>

My requirement is to handle job stop and I can do it overriding stop() in xmlRead (first step). 
The problem is I need also to be sure second step is always executed, but from my tests if I run the following code inside XmlRead first batch:
        if (shouldStop) {
            log.warn("xmlRead - job stopped by user");
            return FAILED.toString();
        }

In the end exit status for the job will be FAILED ( correct ! )  but second step is never executed. 
Any idea how to model this scenario ? 

A:

You can have a list of transition elements inside the first step, instead of the next attributem, to direct the execution flow of the job depending on the exit status (the return value from the batchlet).  Somethig like the following:
<step id = "step1">
  <batchlet ref="xmlRead"/>

  <next on = "flag1" to = "step2"/>
  <stop on = "flag2"/>
  <fail on = "flag3"/>
</step>

Step2 can watch for the same condition from some other common application component to decide on what to do, or you can save the condition as job execution data (see somehow related discussion)
I've just created a sample batch app batchlet-singleton.war to demonstrate the use of batchlet, singleton session bean, and conditional transition.