Could anybody tell me is there a way to retry a compensational Service Task in case of an exception occurring? And if there is how can it be achieved?
I tried barely everything - to mark the compensational Service Task as async before/after and set Retry Time Cycle. Even to mark Intermediate Throw Event as asynchronous and set retry there. But it always executes only once.
I’m trying to resolve the following problem: let’s pretend that we have some Boundary Event occurred during the Process Instance execution. And it leads us to compensation handling procedure. And let’s say that in one of the compensational Service Tasks we have an interaction with a third party service through the HTTP and this service is currently unavailable. So we want to wait a timeout and try once more.
Marking the compensation throw/end event as async before and adding some retry configuration ,ie 5 retries every 1 minute should work. This should configure the compensation event to retry itself successfully in the engine. I just tried this locally and it worked out fine.
For the second part, if the service being called is down, there is no way for Camunda to know this unless Camunda checks for validity. For example by checking for a response, status or something else that such rest endpoint returns.
In this following image I show how I check the response for a variable called “test”. If it doesn’t exist, then my service task will fail. Which would consume one of my retries…
Could you describe the way you reproduced situation when you found out that compensation Service Task async retry works for you? Maybe there’s something missed by me… What if I just hardcode the RuntimeException inside a JavaDelegate of compensation. Should it be perceived as job failure and forward me to the retry?