Skip to content

Job restart after stop fails #1287

Closed
Closed
@spring-projects-issues

Description

Chris Haas opened BATCH-2315 and commented

In our jobs we use the following construct to conditionally stop a job based on a property passed into the job:

<decision id="decisionId" decider="decider">
    <stop on="NEEDS_FINALIZATION" restart="placeAccounts"/>
    <next on="*" to="placeAccounts"/>
</decision>

In Spring Batch 2.1, "placeAccounts" is executed when the job is restarted. In Spring Batch 3, the decision is re-executed, which of course means the job immediately stops again.

In 3.0.1, the job's flow has stateTransitions for the decision look like

StateTransition: [state=placementImport.placementFinalizationDecision, pattern=*, next=placementImport.placeAccounts],
StateTransition: [state=placementImport.placementFinalizationDecision, pattern=NEEDS_FINALIZATION, next=placementImport.stop60],
StateTransition: [state=placementImport.stop60, pattern=*, next=null],

but in 2.1, they look like:

StateTransition: [state=placementImport.placementFinalizationDecision, pattern=*, next=placementImport.placeAccounts],
StateTransition: [state=placementImport.placementFinalizationDecision, pattern=NEEDS_FINALIZATION, next=placementImport.stop60],
StateTransition: [state=placementImport.stop60, pattern=*, next=placementImport.placeAccounts],

Notice that the next element on stop60 is blank, which is probably the cause of the problem.


Affects: 3.0.1

2 votes, 3 watchers

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions