jsr352jberetjbatch

Jsr 352 - forcing to step regardless the status


I'm using jberet implementation of jsr 352.

My purpose is to provide a final step in which I send an email with batch information status.

Therefore, even if the previous step (can be either batchlet or a chunk) terminate with unexpected error, I must go through the final step and report what happened.

What is the best approach to do this? Maybe using some listeners?


Solution

  • Yes, javax.batch.api.listener.JobListener#afterJob is the best place to do that. See its javadoc here.