Camunda 7 Extension of Compensation Behaviour, Spring Boot Starter

Hi all,

thanks for taking your time reading through this :slight_smile:

For my master thesis, I want to extend some of the Camunda 7 behaviour regarding compensation. In short, I’ve been researching on error handling methods and concepts that support partial compensation.

Two such concepts I want to implement. They are called Savepoint and Alternative Paths.

A savepoint is a process state where compensation can end. It is a highlighted task (like a task type), that when successfully completed, removes the need to execute a global compensation to the beginning of the process model, instead it only needs to compensate to this task.

An alternative path (AP) is a unit of work that is wrapped by two AP gateways. The AP split gateway will trigger the first alternative flow and if an error occurs on this path before reaching the AP join gateway, compensation is executed until the AP split gateway is reached (like a savepoint). Then the second alternative is triggered. This continues until either the AP join gateway is reached without an error or an else-path is taken, which throws an error.

Lastly, I also want to further implement retry tasks, that specify a retry count and a cooldown period for a task, if it fails. I know Camunda retries 3 times by default, hence I probably need to adapt this.

I’ve been recommended to try the following approach:

  1. Set up a new SpringBoot project with Camunda 7 Spring Boot Start
  2. Define special activities in BPMN by using [ExtensionElements](
  3. Implement [ActivityBehaviors]( for the special task types (also for new gateways)
  4. Implement a [ParseListener]( as a ProcessEnginePlugin, which, analogous to [](, overwrites the Activity Behaviour for the special types

So far so good, I’ve been trying myself at the Spring Boot Setup so far.

Still open questions remain and I would appreciate feedback regarding the approach.

My goal is to show that the behaviour I define in the thesis can be executed. I think the simplest solution would be to write unit-tests executing a sample process that then logs the correct execution of the behaviour.

My question:

  1. Can I adapt Camunda behaviour (retry counts, compensation behaviour) with this spring boot approach?
  2. Are there easier ways to implement my approach?
  3. How can I write a Unit Test that deploys a process model and triggers an error in a specific task? I know that I can use Script Tasks to throw errors, is there a better way?
  4. Are there any examples/guides for this approach? For example, the unit testing, adding new behaviour with an element? That could help.

I’m thankful for any pointers and appreciate the time. I can also provide some more detailed behaviour descriptions, which are still work in progress. See for this the PDF here

Thanks in advance!

I’ve found an example for a unit test using Spring Boot here

Hi @SandroSp. :wave:

The approach sounds reasonable. :+1: The example with the external task service is useful.

In the end, we probably build a process engine plugin that adds the new behavior. Then, the plugin can be configured for a process engine, for example, in Spring Boot setup.

However, you don’t need Spring Boot for the plugin. You could use the starter to test the behavior. For testing, a simple JUnit test is fine.

Implementing the new compensation behavior could be tricky. As inspiration have a look at

Enjoy the hacking. :rocket: