UPDATE 2: I fixed the hyperlinks so they don't redirect to www.example.com, apologies for the mistake on my part!
UPDATE: I made a new account on the Activiti Forum and my topic was finally posted, so it's probably better to address the issue on the forum now. The link to the topic is here: https://forums.activiti.org/content/issue-getting-signal-boundary-event-trigger
Please take a look at it and thank you!
My apologies for bringing up this issue here as I realize it's likely more of a conceptual issue than a bug, but on the Activiti forum my newly created topic would not post for some reason. As this is crucial to my (and probably others') workflows, I thought I'd directly ask the experts here on JIRA. I've been working on a project using Activiti 6.0.0.Beta2, and I've run into an issue with signal boundary events attached to user tasks not triggering. I've searched and made adjustments to my code based on what other people on this forum have said worked for them, but unfortunately I'm still having the same issue. I've created a unit test in Java along with a corresponding BPMN diagram which I've included below to illustrate the problem. The BPMN diagram is as follows:
The corresponding XML source code for the diagram follows:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:tns="http://www.activiti.org/test" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:yaoqiang="http://bpmn.sourceforge.net" exporter="" exporterVersion="" expressionLanguage="http://www.w3.org/1999/XPath" id="m1452892595912" name="" targetNamespace="http://www.activiti.org/test" typeLanguage="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL http://bpmn.sourceforge.net/schemas/BPMN20.xsd">
<signal activiti:scope="processInstance" id="cancelSignal" name="Cancel Signal"/>
<process id="signalTestProcess" isClosed="false" isExecutable="true" processType="None">
<userTask completionQuantity="1" id="userTask" implementation="##unspecified" isForCompensation="false" name="User Task" startQuantity="1">
<boundaryEvent attachedToRef="userTask" cancelActivity="true" id="cancelTask" name="Cancel Task" parallelMultiple="false">
<signalEventDefinition id="cancelTaskEvent" signalRef="cancelSignal"/>
<startEvent id="startEvent" isInterrupting="true" name="Start Event" parallelMultiple="false">
<sequenceFlow id="startFlow" sourceRef="startEvent" targetRef="userTask"/>
<endEvent id="normalEndEvent" name="End Event">
<sequenceFlow id="cancelFlow" sourceRef="cancelTask" targetRef="cancelEndEvent"/>
<endEvent id="cancelEndEvent" name="End Event">
<sequenceFlow id="normalEndFlow" sourceRef="userTask" targetRef="normalEndEvent"/>
The code for the unit test follows:
Assert.assertEquals(1, runtimeService.createExecutionQuery().signalEventSubscriptionName("Cancel Signal").list().size());
.map(h => h.getActivityName)
When I run the unit test I get the error "java.lang.AssertionError: Expected :0 Actual :1" corresponding to the assertion in the last line. Also, the println function prints "User Task". These results seem to imply that after signalEventReceived is run, the execution remains at User Task instead of going down the signal boundary event flow. In terms of common issues with signal events that I've addressed in my code, the signal name (and not the signal id) is passed to signalEventReceived and the cancelActivity attribute for the signal boundary event is set to true. Also, as the first assertion passes successfully, I'm pretty certain that the correct execution id is being passed to signalEventReceived. If anyone could provide insight on why the execution still refuses to go down the signal boundary event flow I'd greatly appreciate it. Thanks!
OSX, Spring hello
I have managed to reproduce your issue. A similar scenario is covered in the unit test:
The only difference between your scenario and the unit test is that the unit test has a different scope for the Signal Event.
If you change the activiti:scope to global, your test will pass.
The scope for signal events is described here:
My assumption is that the processInstance scope makes sense when the Signal Event is thrown from inside the process (a SignalThrowingEvent).
When the signal is "thrown" from the API then the global scope should be used. If you specify the executionId, like you did:
Then only that executionId is notified (not all executions).
I have created a unit test with two processes to check that only one of them catches the event when an executionId is specified. You can find the test here:
Is the verdict that this is not an issue? Or, should it at least be resolved as WONT FIX?