Engineering
Gracefully Cancelling a Process Instance
Cancelling a running process instance in Camunda is easy: DELETE /process-instance/{id} or, using Java API: RuntimeService.deleteProcessInstance(String, String) this will simply delete the process instance and remove it from the database. Sometimes this is exactly what you need. However: what if you want to cancel the process instance gracefully? Gracefully in the sense that the effects it has had on the outside world are undone? The answer to this is compensation. In this post I discuss two ways to implement compensation. Internal Compensation Modeling compensation inside the process itself: The compensation undoes the effects of the process so far. This is usually modeled in a way where you attach a compensation handler to those service tasks which have effects on…
By Daniel Meyer
