cancel
Showing results for 
Search instead for 
Did you mean: 

How is it possible to listen to failed executions?

kaech
Champ in-the-making
Champ in-the-making
I registered a custom execution listener to an activity using AbstractBpmnParseListener.

public class MyListener implements ExecutionListener {
    public void notify(DelegateExecution execution) throws Exception {
        // do something
    }
}

public class MyParseListener extends AbstractBpmnParseListener {
    private MyListener listener = new MyListener();

    public void parseServiceTask(Element serviceTaskElement, ScopeImpl scope, ActivityImpl activity) {
        activity.addExecutionListener(PvmEvent.EVENTNAME_START, listener, 0);
        activity.addExecutionListener(PvmEvent.EVENTNAME_END, listener);
    }
}

On successful serviceTask execution both listeners are called. When  a JavaDelegate that throws an Exception is executed the end listener is not called. I guess this is normal behaviour.

How can I get information about service executions that fail?
1 REPLY 1

jbarrez
Star Contributor
Star Contributor
The easiest would be to catch the exception in the service task, throw a BpmnError exception which is caught on the boundary of the service task or any container around a group of steps.