• Forum
  • Jobs
  • Rollback all completed jobs in a chain

 
Rollback all completed jobs in a chain

I'm writing an application where I'm chaining jobs by calling executeBatch for the next job in the finish method of the previous one.

In case a job somewhere in the chain fails, I'd need to rollback the operations of not only the current job, but all the previously completed jobs. I would assume that for the current job, I'd need to initialize a savepoint in the constructor and then if an error occurs, do a rollback in the catch block. But how would I handle the jobs that finished successfully too? Do I initialise a savepoint at the start and pass it along through the chain?

I could also consider initialising a savepoint, serialising it and storing it in the database to retrieve later if needed, but I'm not sure this is possible.
Topic archived. No new replies allowed.