Task error handling, job retries

Hi All,
I am looking for some advice on the following. In my workflow I am implementing a service task using a Java delegate. The task is executed as an async-continuation using a job. I am currently using the default retry logic. Inside the delegate I would like to generate an error notification, but only when the number of job retries is down to zero. I have tried building job queries using information from the execution context, but no success so far.

I am also wondering whether this is the right approach; maybe I would be better off defining some kind of failed jobs handler that is triggered when job actually fails.

Any pointers would be most appreciated.

Thanks. Peter

1 Like

Hi Peter,

Off the top of my head, there are two approaches which may meet your requirement…

One approach is to use an incident handler. When the retry policy is exceeded, the engine will raise an incident and suspend the execution. You could consider a custom incident handler to perform a notification activity (see here)

An alternate approach could be to take remedial action in the process itself. Have a look at this thread - fail fast. If you look at the sample code, you can see how you can tell you are in a job executor context and the number of retries remaining…

regards

Rob