Manikandan Kbk DIP
Manikandan Kbk DIP

Reputation: 483

Retry failures for triggerable java service tasks

I’m not sure how to handle retries when it comes to handling failures for triggerable service tasks.

Let’s take a simple BPMN where it follows startEvent → serviceTask (async = true and triggerable = true) → endEvent

serviceTask (our custom JavaDelegate) makes rest calls to another service (let’s call serviceB) and goes to a wait state. Then serviceB will make callback to our Flowable service with either SUCCESS/FAILURE callback. In case of SUCCESS callback, I can trigger and complete the task.

requirement: In case of failure callback, how do I ensure to retry the JavaDelegate.execute() method again? because the control of the Flowable is in wait state of serviceTask now.

Our use case is to retry above requirement 3 times. After 3 retries move the execution to deadletter. When trying to bring back the execution from deadletter, again it should start from JavaDelegate.execute().

Upvotes: 1

Views: 764

Answers (1)

Andrey Kotov
Andrey Kotov

Reputation: 26

For retry your "serviceTask" you can use

processEngine.getRuntimeService().createChangeActivityStateBuilder()
                .moveExecutionToActivityId(activity.getExecutionId(), activity.getActivityId())
                .changeState();

https://forum.flowable.org/t/retry-javadelegate-which-is-triggerable/5225

Upvotes: 1

Related Questions