Global error handling for async triggerable Service Tasks

Hello! We are using async triggerable service tasks in our BPMN model. Each task starts some external execution via REST request to a remote server and that external processing sometimes could fail. We could signal the awaiting execution that the external task is finished and we could also signal it with an error event (if it had happened). But we need to provide a Boundary Event for each ServiceTask to capture the error and to stop futher workflow execution.
Is there a way to catch all the errors in all such Service Tasks inside workflow without putting them all in a subprocess or without creating a Parallel Gateway with two branches - one for normal execution and another one - for capturing errors?
The idea is to have a global error handler for the whole workflow.
Thank you!

Hi Vladimir,

One possiblity (I am not saying only one) is to add boundary events automatically in process definition parsing. https://www.flowable.org/docs/userguide/index.html#advanced_parseHandlers

Regards
Martin

1 Like

Thank you, Martin! Nice solution.

@vladimirKhil Are you using triggerable with http service task ? or is it through java delegate? I am not able to use triggerable with http service task . Please let me know what I am missing

I am using triggerable with java delegate. Http call is located inside Java code.

Thanks for your reply.

Vladimir, how is it possible? Do you mean using one of the following:

    processEngine.getRuntimeService().signalEventReceived(...);
    processEngine.getRuntimeService().messageEventReceived(...);
    processEngine.getRuntimeService().dispatchEvent(...);

or something else?
Thanks in advance.

Yes, your can signal an execution with ‚ÄúsignalEventReceived‚ÄĚ action, as described here: REST API ¬∑ Flowable Open Source Documentation