Search code examples
batch-processingwebsphere-libertyjsr352java-batch

JSR352 decide next step based on return parameter from Decider


I would like to implement a Decider that returns the ID of the next step that needs to be executed. (This question is related to my other question here if you would like to know why I'm trying to do this: JEE Batch Job Specification with many optional Steps)

<decision id="decider1" ref="skipNextStepDecider">
    <properties>
        <property name="condition" value="isExecuteSteps"/>
    </properties>
    <next on="*" to="STEP_ID_RETURNED_BY_DECIDER"/>
    <end on="SKIP"/>
</decision>

Is there any way to do this? I am using JSR352 with Websphere Liberty in case this is relevant.

UPDATE

My intent was to avoid the following:

<decision id="decider1" ref="skipNextStepDecider">
    <properties>
        <property name="condition" value="isExecuteSteps"/>
    </properties>
    <next on="STEP1" to="step1"/>
    <next on="STEP2" to="step2"/>
    <next on="STEP3" to="step3"/>
    <end on="SKIP"/>
</decision>

Solution

  • To do this you'd need to know the possible target steps ahead of time...

    The JSL gets parsed up front (mostly) so there's nothing you can put in the 'to' value that would resolve with a result from the step/decider processing.

    Might be an interesting spec update possibility.