I am trying to understand how the exception handling works in a sub process. When an exception is thrown in the sub process the flow is being terminated and the calling process instance is also stopped. Is this expected?

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

I am trying to understand how the exception handling works in a sub process. When an exception is thrown in the sub process the flow is being terminated and the calling process instance is also stopped. Is this expected?

Our main process definition starts with a call to am embedded sub process, when an exception occurs in the firs service task of the sub process the exception is propagated up the stack all the way up to where the parent process is initiated. This kills the parent and sub process. Is this expected behaviour? If this sub-process were just a Service Task when an exception occurs we would have the in built retry attempts, why do we not see this behaviour in the sub-process service task?

1 Reply
Highlighted
Intermediate

Re: I am trying to understand how the exception handling works in a sub process. When an exception is thrown in the sub process the flow is being terminated and the calling process instance is also stopped. Is this expected?

Anything other than a BpmnError() will cause termination of the process instance and will cause the parent process to fail. Technical exceptions must be handled inside your service code, business exceptions, or technical exceptions that need to be ultimately handled manually should throw BpmnError() exceptions. These can be caught in the process flow and will automatically bubble up the execution stack. 

The Book, Activiti in Action covers exception handling at length.

Regards,
Greg