cancel
Showing results for 
Search instead for 
Did you mean: 

BpmnError not caught in boundary

larxxor
Champ in-the-making
Champ in-the-making
I'm doing som investigations in Activiti 6 beta2.

Created a flow, with different type of tasks, listeners etc.

Wanting to test boundary error catching, I put a ServiceTask in a subprocess.
The ServiceTask calls a java delegate, which throws a BpmnError in the execute method :


LOGGER.info("throw BpmnError");
throw new BpmnError("123");


I attach an "ErrorBoundaryEvent" on the subprocess. ErrorCode = "". The boundary event is attached to a ServiceTask, and has a listener with log statements on the "start" event.

Execution of the main flow stops on the BpmnError, but nothing happens in the listener at the ErrorBoundaryEvent. No logs. I have listeners in place on UserTasks and ServiceTasks, they all log nicely.
If I investigate the tables, I can see in "ACT_HI_ACTINST", that the flow hits the Error Boundary and continues to the attached ServiceTask. The flow is ok then.

This leaves the question : why is the listener on the ErrorBoundaryEvent not running notify()?
8 REPLIES 8

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Larxxor,

jUnit test would help.
https://forums.activiti.org/content/sticky-how-write-unit-test

Regards
Martin


I am exploring this further, and it seems that listeners is sometimes not called, for some reason.

I have a case where a TaskListener works nicely in one process, but is never called in another. In designer, those two UserTask look completely identical.
I will investigate and work on a junit test.

larxxor
Champ in-the-making
Champ in-the-making

Well, I have identified the issue. It has to do with subprocesses.

I have attached a simple bpm : "junit2.bpmn"
It has no subprocesses, a single UserTask with a listener. It works as expected.

I have attached a another bpm : "junit.bpmn"
It has a UserTask within a subprocess, with the same listener. It never calls the listener.

The same happens for boundary events on subprocess, which was my original issue.

larxxor
Champ in-the-making
Champ in-the-making

I created JUnit test for it : It is a regression in Beta2 !

Created two junit tests, one with, one without listener inside subprocess.

It works in Beta1, fails in Beta2. You want me to create Jira issue with the junit tests, I assume?

larxxor
Champ in-the-making
Champ in-the-making

Jira issue ACT-4133

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

could attach the whole project with java jUnit test class?

Regards
Martin

larxxor
Champ in-the-making
Champ in-the-making

Ahem, I uploaded the complete project to ACT-4133. Do you mean attach to forum?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Larxxor,

Sorry my fault - I did not check jira issue.
The problem is already solved in the master head revision. The problem was that process bpmn did not search for tasks inside subprocesses.

      FlowElement flowElement = process.getFlowElement(taskEntity.getTaskDefinitionKey());

was changed to


      FlowElement flowElement = process.getFlowElement(taskEntity.getTaskDefinitionKey(), true);

in org.activiti.engine.impl.persistence.entity.TaskEntityManagerImpl#fireTaskListenerEvent
Regards
Martin