Announcement Announcement Module
No announcement yet.
ExitStatus and how should a Tasklet cause a Job to fail? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ExitStatus and how should a Tasklet cause a Job to fail?

    Newbie question: I want a Job to fail if certain criteria are not met within a Tasklet (being invoked via TaskletStep). I assumed that returning ExitStatus.FAILED from the execute method would do this, but it looks like the only way to cause a Job to fail is to throw an exception from a Tasklet.

    Is this correct and what is the meaning of ExitStatus in this context - does it have any effect on behaviour of Job?
    Last edited by ndw; Mar 26th, 2008, 02:45 PM. Reason: Typo in ExitStatus

  • #2
    That is correct, throwing an exception from Tasklet indicates that it failed, and returning an ExitStatus of any type indicates that it finished successfully. The value of the ExitStatus is really just there for reporting purposes (we store the exit code in the meta data tables)


    • #3
      Arguably we should change the signature of Tasklet to make this more obvious - there is not reason for it ever to return ExitStatus.CONTINUABLE. It's just nice to have the exit code and exit description in the database.