1

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>
taranaki
  • 778
  • 3
  • 9
  • 28

1 Answers1

2

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.

DFollis
  • 419
  • 2
  • 5
  • I do know the possible target steps ahead of time. How does this help me? (I want to avoid having a long list of next properties) – taranaki Dec 06 '19 at 14:42
  • @DFollis is just pointing out an implication of this solution. The fact that you know the complete list of steps ahead of time makes this a possible solution. It doesn't make it any cleaner or more elegant; you'd have to include the long list of next elements. If you didn't know the target steps this would be a non-starter. – Scott Kurz Dec 06 '19 at 15:09
  • The reason this isn't possible falls under the broader issue in which JSL substitution generally doesn't allow any values that are calculated at execution time (which is another point made by @DFollis). We had this issue opened against the JSR 352 spec... we haven't revived the issue tracker for the Jakarta Batch project yet but should as a next step in Jakarta. – Scott Kurz Dec 06 '19 at 15:14
  • Thank you very much for clarifying. – taranaki Dec 10 '19 at 07:54