Hi all,
thanks for taking your time reading through this
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:
-
Set up a new SpringBoot project with Camunda 7 Spring Boot Start
-
Define special activities in BPMN by using [ExtensionElements](https://docs.camunda.org/manual/7.21/user-guide/model-api/bpmn-model-api/extension-elements/)
-
Implement [ActivityBehaviors](https://github.com/camunda/camunda-bpm-platform/tree/master/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/behavior) for the special task types (also for new gateways)
-
Implement a [ParseListener](https://github.com/camunda/camunda-bpm-examples/blob/83941d97825fdc488bf582cd4b3ae14672dabf9a/process-engine-plugin/bpmn-parse-listener/README.md#create-a-bpmn-parse-listener-implementation) as a ProcessEnginePlugin, which, analogous to [BpmnParse.java](https://github.com/camunda/camunda-bpm-platform/blob/eabe8087b5cb75aa782798910fad0c6100eb5f59/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L62), 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:
- Can I adapt Camunda behaviour (retry counts, compensation behaviour) with this spring boot approach?
- Are there easier ways to implement my approach?
- 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?
- 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!