Handle 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().

See my answer on Handles failures for triggerable java service tasks - #3 by joram