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 ?