You don’t have to rollback the step 2. Apparently, you don’t have any async points in the process model (otherwise you wouldn’t be able to send responses to the REST call). Hence the whole process is executed in one transaction. And on the thread serving the REST request.
If the DB you save the order to is another one than the one used by Camunda, and you don’t have a distributed tx manager, the order will be committed, you can’t do a rollback then.
it sounds like you have to handle distributed transactions. BPMN 2.0 supports them with Compensations. You write an explicit task to delete the data from the Oracle DB and invoke it as a compensation task.
@Ingo_Richtsmeier, would this also work if the process has no async points at all? If I understood the OP correctly, the process does not have them because it sends a synchronous reply to a REST request after the third activity has been executed.
generally, yes. It depends on the rollback operation, if you want to delete a dataset that is not yet committed to your business database you will get an issue there. If you invoke two synchronous rest calls to add and remove a dataset, all is fine.
The compensation will be invoked in the same thread of the engine if no asynchronous continuation is set.