I made a BPMN diagram with a custom work item on it. I then dropped an Intermediate Error Event node on the boundary of it, hoping to catch error events (signals) that my custom work item handler was going to throw.
When it finds an error, my work item handler first tried to throw a simple error event:
getSession().signalEvent("Error-MySpecialError", null, myProcessId)
But the boundary event node did not hear this. I did some code surfing, and it seems that I need to have the WorkItem's XML node ID as part of the error signal name. In my XML I see:
<bpmn2:boundaryEvent id="_798B5649-CE5B-453A-817E-8FE584A5165F" drools:bgcolor="#f5deb3" drools:selectable="true" drools:bordercolor="#a0522d" drools:boundaryca="true" name="Start Job Failed" attachedToRef="_C0313817-B82A-45E7-81D8-478392503BC9"> <bpmn2:outgoing>_4653183B-7B90-4570-BCF5-7E3DAAD78D70</bpmn2:outgoing> <bpmn2:errorEventDefinition id="_7oZvwI3iEeOf5d86lsEEBg" drools:erefname="JobControlError" errorRef="JobControlError"/> </bpmn2:boundaryEvent>
And in the process code there is a section where potential boundary node targets are consulted via their event filters. The event my boundary node will accept is:
This seems to be a custom event type designed by combining the attachedToRef metadata value so to be heard only by the boundary event node, which seems to make sense. But how can I send this event from my work item handler? Is there a proper ignalEvent() API method I should be using that will handing this naming convention for me? I tried sending the signal via the WorkItemManager but it didn't work either:
workItemManager.signalEvent("Error-MySpecialError", null, processInstanceId);