Mar 26th, 2008, 02:44 PM
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 at 02:45 PM.
Reason: Typo in ExitStatus
Mar 26th, 2008, 10:10 PM
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)
Mar 27th, 2008, 12:46 AM
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.