Unhandled exceptions in service task

414 views
Skip to first unread message

jayend...@scimergent.com

unread,
Jul 23, 2015, 7:41:08 AM7/23/15
to camunda BPM users
Hi

I created a simple process that has a service task that calls a java class that just throws a RuntimeException. This is followed by an user task.

Let's say for example my java code tried to access a web service, but the service instance was down, I'd like to 'resubmit' the process instance to the same step once the service is up again. How can I achieve this?

Best regards,
Jayendran

thorben....@camunda.com

unread,
Jul 23, 2015, 8:55:05 AM7/23/15
to camunda BPM users, jayend...@scimergent.com
Hi Jayendran,

You can solve this by using asynchronous continuations in your process, e.g. before the service task. The process engine has a retry mechanism for process parts executed asynchronously (default: three retries without a timeout; this is configurable). It does not have a retry mechanism for anything that is triggered synchronously in the context of the thread in your client code (e.g  anything during runtimeService#startProcessInstanceByKey) but propagates the exception instead.

You can check the documentation on asynchronous continuations [1], the job executor [2], and in particular handling of failed jobs [3] for details.

Cheers,
Thorben

[1] http://docs.camunda.org/7.3/guides/user-guide/#process-engine-transactions-in-processes-asynchronous-continuations
[2] http://docs.camunda.org/7.3/guides/user-guide/#process-engine-the-job-executor
[3] http://docs.camunda.org/7.3/guides/user-guide/#process-engine-the-job-executor-failed-jobs

jayend...@scimergent.com

unread,
Jul 24, 2015, 9:15:30 AM7/24/15
to camunda BPM users, thorben....@camunda.com
Hi Thorben,

This is pretty good and it works as i expected!

If max retry exceed, incident is created as failed Job, able to retry manually.

Let me know is there possibility to trigger a nofification(email) for a incident.


Best regards,
Jayendran


Philipp Ossler

unread,
Jul 28, 2015, 5:47:49 AM7/28/15
to camunda BPM users, jayend...@scimergent.com
Hi Jayendran,

it is possible to implement a custom handler for incidents and send an email, for example. 
You can check the documentation on Incidents [1].

Greetings,
Philipp
Reply all
Reply to author
Forward
0 new messages