1

I am trying to improve exit information for some JSR-352 batch job. So far I use Wildfly (and the included JBeret implementation), and my last batch step returns

  • batch status: COMPLETED
  • exit status: WARNING

However, when looking from 'outside' at the job, I see

  • batch status: COMPLETED
  • exit status: COMPLETED

How can I change the job's exit status to "WARNING"?

Queeg
  • 7,748
  • 1
  • 16
  • 42

1 Answers1

1

You can set the job's exit status programmatically in one of your batch artifact classes, via JobContext.setExitStatus method.

cheng
  • 1,076
  • 6
  • 6
  • So the secret is to distinguish between StepContect and JobContext. Do not assume the last step exit status to automatically become the job exit status, as it is the case in so many scripting languages. – Queeg Dec 02 '20 at 13:03
  • Right. If you want the job's exit status to be that of the last step, you can set it in [JobListener or StepListener](https://javaee.github.io/javaee-spec/javadocs/javax/batch/api/listener/package-frame.html) – cheng Dec 03 '20 at 14:12