Does a retry external service task re-run start execution listener?

Hello,

I’m trying to understand the retry behavior of an external service task but I’m not able to find into the documentation and I would like if the current behavior that I have is the normal one.

I have a basic service external task (content doesn’t matter) with a start execution listener and an end execution listener too.
The external task behavior is to catch each Exception as an incident with handleFailure(...) method and a positive retry.

Based on this picture :

process-engine-activity-execution

It seems that when the external task raised an incident and the retry happen, the start execution listener is not called again.

Is that normal ? My need is to restart at step 2 rather than step 3.

Thanks for your help !
Anthony

Hi Anthony

Looking at the Camunda docs External Tasks | docs.camunda.org it says: “When setting retries to a value > 0, the task can be fetched again after retryTimeout expires. When setting retries to 0, a task can no longer be fetched and an incident is created for this task”

I expect that retries for external task is a matter of having the engine offer a task again, if an external worker could not process the task successfully. The handleFailure method is to instruct the engine on how to do that (either offer it again or create an incident).

I have not tested this, but I dont think you can expect the token to be moved back to the start of the activity and have the listener executed again.

BR
Michael

Hi Anthony,

Micheal is correct: The start listener is not executed again. As the listener is part of the previous transaction and this transaction is already commited when the external-task gets available to the fetch & lock mechanism, it will not be rolled back after the external-task-handler calls handleFailure(...).

BR rnschk :slight_smile:

1 Like

Hi guys,

Thanks for your answers. I was not really clear on my explanation and I made a mistake on my language about the incident.

I understand better what happens on my workflow now and I will manage to return before the activity with a different behavior.

Thanks !