Compensation Events retrying

Hello!

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.

Regards.

Hey @Artem_Spasov,

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…

However, If I don’t check for something to prove that my service call was successful then Camunda will just process such service task as completed.

Does this make sense?

Regards,

1 Like

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?

Thanks!

I mean maybe it got to be some specific kind of exception to be thrown to lead to the retry.

Hey @Artem_Spasov,

See my process attached to this response. Notice the properties in the Compensation End Event and the Compensation Service Task.

Were you able to figure it out?

Regards,