Execution Listener for processes that error out

570 views
Skip to first unread message

galen...@gmail.com

unread,
Oct 22, 2014, 8:11:11 PM10/22/14
to camunda-...@googlegroups.com
Hi,

I'm trying to figure out the best way to get a callback method when a process stops executing due to an unexpected exception or a BpmnError being thrown that's not caught. In other words there is no boundary events catching anything, and the error just propagates up, forcing the process to end. The end event is never reached in this case. I want to be able to run code if this happens.

I don't think the global execution listener would work for this case.
Any ideas or best practices here?

Thanks,
Galen

thorben....@camunda.com

unread,
Oct 24, 2014, 8:58:33 AM10/24/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Galen,

There is no API feature to achieve this.

If there is an internal feature that allows to do this depends on what you want to achieve. You can write a CommandInterceptor that allows you to catch exceptions on the command level and register it with the process engine configuration. Roughly speaking, a command corresponds to one API call, so this catches exceptions on a more coarse-grained level than process definitions. Furthermore, this interceptor would be executed after the process engine transaction rolls back. Don't hesitate to ask if you would like to get more details on this.

I do not see another possiblity to achieve such a behavior at the moment. I'd like to learn what your use case is that requires such a feature.

Cheers,
Thorben

galen...@gmail.com

unread,
Oct 24, 2014, 2:59:55 PM10/24/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Thorben,

There might be cases where a workflow is running in production, and the developer of the flow might not have thought of all possible failure cases. In other words, they may not have put in place appropriate boundary conditions and or alternate flows where necessary.

At runtime, if the flow (unexpectedly) bubbles out, and does not complete, I may want to email an admin user of this occurrence. If a process fails, it will not show up in the Cockpit anymore to diagnose the problem, as it's not alive.

Does this make sense? Perhaps there is a more built-in way to do something like this that I'm not thinking of. If not, do you have any examples of implementing a CommandInterceptor?

Thanks,
Galen

Christian Lipphardt

unread,
Oct 24, 2014, 3:14:54 PM10/24/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Galen,

Thanks for the description of your use cases.

Regarding this point of yours:


If a process fails, it will not show up in the Cockpit anymore to diagnose the problem, as it's not alive.
Does this make sense? Perhaps there is a more built-in way to do something like this that I'm not thinking of.

If you start the process asynchronously, e.g. set the StartEvent async, a job will be created and executed by the job executor. In case an exception is thrown which bubbles up to the top, the job will be executed three times. If then the failure is still there, an incident will be created and it is visible inside cockpit, that a failed job exists. This job can be retried then through cockpit.
There is also the possibility to create own incidents through creating a custom incident handler [1] which applies for jobs.

Cheers,
Christian

galen...@gmail.com

unread,
Oct 24, 2014, 4:34:39 PM10/24/14
to camunda-...@googlegroups.com, galen...@gmail.com
Hi Christian,

Thanks for the hint of setting my StartEvent to async. However, setting my StartEvent to asyc broke the form variables. See:

https://groups.google.com/forum/#!topic/camunda-bpm-users/k1G1gZhwY0w

I'll look into the Custom incident hander.

Thanks!
Galen

Reply all
Reply to author
Forward
0 new messages