Hi,
I have a problem regarding the query of signal.
I'm trying to use signalEventReceived(signalName,executionId) to trigger a boundary signal. However it does not work, it says that Execution xx has not subscribed to a signal event with name xx.
And when I query for the active execution , there is no eventSubscription, the list is empty.
But when I inspect the execution (in Java , in debug mode) I can access the executions object which contains the ScopeExecution and this scope contains the SignalEventSubscriptionEntity of the correct signal.
Is it possible to access the ScopeExecution through the runtimeService , if so how can I get the proper ScopeExecution id and which query shall I use?
Maybe there is something wrong with my bpmn , because the request
runtimeService.createExecutionQuery().signalEventSubscriptionName(signalName) should be returning the execution that has the signal register but it return null instead.
I'm using Activiti 5.19.0.2 integrated into ServiceMix and Camel.
Thanks for the help,
Jean-Philippe.
Here is my BPMN
<?xml version="1.0" encoding="UTF-8"?>
<!-- origin at X=0.0 Y=0.0 -->
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:camunda="http://activiti.org/bpmn" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" xmlns="http://www.jboss.org/drools" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd http://www.jboss.org/drools drools.xsd http://www.bpsim.org/schemas/1.0 bpsim.xsd" id="_EiNnUCRfEeO2cYCcDeOX2w" exporter="org.eclipse.bpmn2.modeler.core" exporterVersion="1.3.2.Final-v20161020-1541-B59" targetNamespace="http://activiti.org/bpmn">
<bpmn2:itemDefinition id="ItemDefinition_1" isCollection="false" structureRef="xs:string"/>
<bpmn2:error id="Error_1" errorCode="camel.error" name="camel.error"/>
<bpmn2:signal id="Message_3" name="camel.signal"/>
<bpmn2:signal id="alertSignal" name="alert"/>
<bpmn2:message id="Message_1" name="camel.answer"/>
<bpmn2:message id="Message_2" name="camel.start"/>
<bpmn2:message id="Message_4" name="cameltest"/>
<bpmn2:collaboration id="_Collaboration_3">
<bpmn2articipant id="camel-participant" name="Camel" processRef="Camel"/>
<bpmn2articipant id="Participant_1" name="Process Engine" processRef="camel-use-cases"/>
<bpmn2:messageFlow id="MessageFlow_1" name="" sourceRef="syncTask" targetRef="camel-participant"/>
<bpmn2:messageFlow id="MessageFlow_2" name="" sourceRef="camel-participant" targetRef="syncTask"/>
<bpmn2:messageFlow id="MessageFlow_4" name="" sourceRef="camel-participant" targetRef="IntermediateCatchEvent_1"/>
<bpmn2:messageFlow id="MessageFlow_5" name="" sourceRef="camel-participant" targetRef="StartEvent_1"/>
<bpmn2:messageFlow id="MessageFlow_6" name="" sourceRef="camel-participant" targetRef="StartEvent_2"/>
<bpmn2:messageFlow id="MessageFlow_3" sourceRef="asyncTask" targetRef="camel-participant"/>
</bpmn2:collaboration>
<bpmn2rocess id="Camel" isExecutable="false"/>
<bpmn2rocess id="camel-use-cases" name="Camel Use Cases" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1" name="message
'start'
received">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[message
'start'
received]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2utgoing>SequenceFlow_2</bpmn2utgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_1" messageRef="Message_2"/>
</bpmn2:startEvent>
<bpmn2:startEvent id="StartEvent_2" name="default
start
event">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[default
start
event]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2utgoing>SequenceFlow_1</bpmn2utgoing>
</bpmn2:startEvent>
<bpmn2:sequenceFlow id="SequenceFlow_1" sourceRef="StartEvent_2" targetRef="ScriptTask_2"/>
<bpmn2:sequenceFlow id="SequenceFlow_2" sourceRef="StartEvent_1" targetRef="ScriptTask_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_4" name="" sourceRef="ScriptTask_1" targetRef="ExclusiveGateway_2"/>
<bpmn2:serviceTask id="syncTask" activiti:delegateExpression="${camel}" name="call some service">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[call some service]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_6</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_7</bpmn2utgoing>
<bpmn2:ioSpecification id="InputOutputSpecification_4">
<bpmn2:inputSet id="InputSet_4" name="Input Set 4"/>
<bpmn2utputSet id="OutputSet_4" name="Output Set 4"/>
</bpmn2:ioSpecification>
</bpmn2:serviceTask>
<bpmn2:serviceTask id="asyncTask" activiti:delegateExpression="${camel}" name="call some async service">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[call some async service]]></drools:metaValue>
</drools:metaData>
<drools:metaData name="customAsync">
<drools:metaValue><![CDATA[true]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_7</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_16</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_8</bpmn2utgoing>
</bpmn2:serviceTask>
<bpmn2:sequenceFlow id="SequenceFlow_7" name="" sourceRef="syncTask" targetRef="asyncTask"/>
<bpmn2:eventBasedGateway id="EventBasedGateway_1" gatewayDirection="Diverging">
<bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_9</bpmn2utgoing>
<bpmn2utgoing>SequenceFlow_22</bpmn2utgoing>
</bpmn2:eventBasedGateway>
<bpmn2:sequenceFlow id="SequenceFlow_8" sourceRef="asyncTask" targetRef="EventBasedGateway_1"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="message
'answer'
received">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[message
'answer'
received]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_9</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_12</bpmn2utgoing>
<bpmn2:messageEventDefinition id="MessageEventDefinition_2" messageRef="Message_1"/>
</bpmn2:intermediateCatchEvent>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_2" name="1 minute">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[1 minute]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_22</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_11</bpmn2utgoing>
<bpmn2:timerEventDefinition id="TimerEventDefinition_1">
<bpmn2:timeDuration xsi:type="bpmn2:tFormalExpression" id="FormalExpression_1">PT1M</bpmn2:timeDuration>
</bpmn2:timerEventDefinition>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_9" name="" sourceRef="EventBasedGateway_1" targetRef="IntermediateCatchEvent_1"/>
<bpmn2:sequenceFlow id="SequenceFlow_11" sourceRef="IntermediateCatchEvent_2" targetRef="ScriptTask_5"/>
<bpmn2:endEvent id="EndEvent_2" name="cancelled">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[cancelled]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_13</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_13" sourceRef="ScriptTask_5" targetRef="EndEvent_2"/>
<bpmn2:endEvent id="EndEvent_3" name="processed">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[processed]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_15</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_15" sourceRef="SubProcess_2" targetRef="EndEvent_3"/>
<bpmn2:sequenceFlow id="SequenceFlow_16" name="" sourceRef="ScriptTask_3" targetRef="asyncTask"/>
<bpmn2:scriptTask id="ScriptTask_1" name="acknowledge message 'start'" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[acknowledge message 'start']]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_4</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("Message Start ::: demoId "+demoId);</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_2" name="acknowledge default start" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[acknowledge default start]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_20</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("Default Start ::: demoId "+demoId);
</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_3" name="acknowledge signal" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[acknowledge signal]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_3</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_16</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("Signal received ::: demoId "+demoId);</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:scriptTask id="ScriptTask_5" name="acknowledge timeout" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[acknowledge timeout]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_11</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_13</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("Acknowledge Timeout")</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:subProcess id="SubProcess_2" name="Sub Process 2">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Sub Process 2]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_17</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_15</bpmn2utgoing>
<bpmn2:startEvent id="StartEvent_3" name="Start Event 3">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Start Event 3]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2utgoing>SequenceFlow_18</bpmn2utgoing>
</bpmn2:startEvent>
<bpmn2:scriptTask id="ScriptTask_6" name="acknowledge answer script" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[acknowledge answer script]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_19</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("Acknowledge Answer ::: demoId "+demoId);</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:endEvent id="EndEvent_1" name="End Event 1">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[End Event 1]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_19</bpmn2:incoming>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_18" droolsriority="1" sourceRef="StartEvent_3" targetRef="ScriptTask_6"/>
<bpmn2:sequenceFlow id="SequenceFlow_19" droolsriority="1" sourceRef="ScriptTask_6" targetRef="EndEvent_1"/>
</bpmn2:subProcess>
<bpmn2:scriptTask id="ScriptTask_4" name="Script Task 4" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[Script Task 4]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_12</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_17</bpmn2utgoing>
<bpmn2:script>var demoId = execution.getVariable("demoId");
java.util.logging.Logger.getLogger("SCRIPT").info("signal received for message "+demoId);</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_12" droolsriority="1" sourceRef="IntermediateCatchEvent_1" targetRef="ScriptTask_4"/>
<bpmn2:sequenceFlow id="SequenceFlow_17" droolsriority="1" sourceRef="ScriptTask_4" targetRef="SubProcess_2"/>
<bpmn2:sequenceFlow id="SequenceFlow_22" droolsriority="1" sourceRef="EventBasedGateway_1" targetRef="IntermediateCatchEvent_2"/>
<bpmn2:scriptTask id="ScriptTask_8" activiti:async="true" name="setVariables" scriptFormat="JavaScript">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[setVariables]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_23</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_6</bpmn2utgoing>
<bpmn2:script>execution.setVariable("executionId", execution.getId());
java.util.logging.Logger.getLogger("SCRIPT").info(execution);
java.util.logging.Logger.getLogger("SCRIPT").info(this);</bpmn2:script>
</bpmn2:scriptTask>
<bpmn2:sequenceFlow id="SequenceFlow_23" droolsriority="1" sourceRef="ExclusiveGateway_2" targetRef="ScriptTask_8"/>
<bpmn2:sequenceFlow id="SequenceFlow_20" droolsriority="1" sourceRef="ScriptTask_2" targetRef="ExclusiveGateway_2"/>
<bpmn2:exclusiveGateway id="ExclusiveGateway_2" gatewayDirection="Converging">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_20</bpmn2:incoming>
<bpmn2utgoing>SequenceFlow_23</bpmn2utgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_6" droolsriority="1" sourceRef="ScriptTask_8" targetRef="syncTask"/>
<bpmn2:boundaryEvent id="BoundaryEvent_1" attachedToRef="syncTask">
<bpmn2:extensionElements>
<drools:metaData name="elementname">
<drools:metaValue><![CDATA[]]></drools:metaValue>
</drools:metaData>
</bpmn2:extensionElements>
<bpmn2utgoing>SequenceFlow_3</bpmn2utgoing>
<bpmn2:signalEventDefinition id="SignalEventDefinition_1" signalRef="alertSignal"/>
</bpmn2:boundaryEvent>
<bpmn2:sequenceFlow id="SequenceFlow_3" droolsriority="1" sourceRef="BoundaryEvent_1" targetRef="ScriptTask_3"/>
</bpmn2rocess>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="_Collaboration_3">
<bpmndi:BPMNShape id="_BPMNShape_Participant_7" bpmnElement="camel-participant" isHorizontal="true">
<dc:Bounds height="73.0" width="1675.0" x="36.0" y="24.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_31" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="43.0" width="17.0" x="42.0" y="39.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_Participant_8" bpmnElement="Participant_1" isHorizontal="true">
<dc:Bounds height="471.0" width="1675.0" x="36.0" y="120.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_32" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="104.0" width="17.0" x="42.0" y="303.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_SubProcess_2" bpmnElement="SubProcess_2" isExpanded="true">
<dc:Bounds height="150.0" width="371.0" x="1156.0" y="155.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_101">
<dc:Bounds height="15.0" width="81.0" x="1162.0" y="158.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_6" bpmnElement="StartEvent_1">
<dc:Bounds height="36.0" width="36.0" x="100.0" y="485.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_1" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="51.0" width="72.0" x="82.0" y="521.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_7" bpmnElement="StartEvent_2">
<dc:Bounds height="36.0" width="36.0" x="120.0" y="168.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_2" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="51.0" width="54.0" x="111.0" y="204.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_ServiceTask_9" bpmnElement="syncTask">
<dc:Bounds height="80.0" width="100.0" x="520.0" y="305.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_35" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="15.0" width="96.0" x="522.0" y="337.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_SendTask_2" bpmnElement="asyncTask">
<dc:Bounds height="80.0" width="100.0" x="720.0" y="305.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_36" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="30.0" width="96.0" x="722.0" y="330.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EventBasedGateway_2" bpmnElement="EventBasedGateway_1" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="874.0" y="320.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_12" labelStyle="BPMNLabelStyle_1"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_2" bpmnElement="IntermediateCatchEvent_1">
<dc:Bounds height="36.0" width="36.0" x="937.0" y="211.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_14" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="51.0" width="72.0" x="919.0" y="247.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_IntermediateCatchEvent_3" bpmnElement="IntermediateCatchEvent_2">
<dc:Bounds height="36.0" width="36.0" x="881.0" y="417.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_15" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="17.0" width="56.0" x="871.0" y="453.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_20" bpmnElement="EndEvent_2">
<dc:Bounds height="36.0" width="36.0" x="1620.0" y="417.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_19" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="17.0" width="62.0" x="1607.0" y="453.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_EndEvent_21" bpmnElement="EndEvent_3">
<dc:Bounds height="36.0" width="36.0" x="1608.0" y="211.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_22" labelStyle="BPMNLabelStyle_1">
<dc:Bounds height="17.0" width="69.0" x="1592.0" y="247.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_1" bpmnElement="ScriptTask_1">
<dc:Bounds height="50.0" width="110.0" x="191.0" y="480.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_3">
<dc:Bounds height="34.0" width="102.0" x="195.0" y="488.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_2" bpmnElement="ScriptTask_2">
<dc:Bounds height="50.0" width="110.0" x="201.0" y="161.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_4">
<dc:Bounds height="34.0" width="90.0" x="211.0" y="169.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_3" bpmnElement="ScriptTask_3">
<dc:Bounds height="50.0" width="110.0" x="619.0" y="480.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_6">
<dc:Bounds height="15.0" width="110.0" x="619.0" y="497.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_5" bpmnElement="ScriptTask_5">
<dc:Bounds height="50.0" width="110.0" x="1264.0" y="410.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_8">
<dc:Bounds height="34.0" width="90.0" x="1274.0" y="418.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_StartEvent_1" bpmnElement="StartEvent_3">
<dc:Bounds height="36.0" width="36.0" x="1186.0" y="217.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_7">
<dc:Bounds height="15.0" width="68.0" x="1170.0" y="253.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_6" bpmnElement="ScriptTask_6" isExpanded="true">
<dc:Bounds height="50.0" width="110.0" x="1276.0" y="210.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_9">
<dc:Bounds height="30.0" width="76.0" x="1293.0" y="220.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_EndEvent_1" bpmnElement="EndEvent_1">
<dc:Bounds height="36.0" width="36.0" x="1436.0" y="217.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_10">
<dc:Bounds height="15.0" width="65.0" x="1422.0" y="253.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_4" bpmnElement="ScriptTask_4" isExpanded="true">
<dc:Bounds height="50.0" width="110.0" x="1011.0" y="205.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_11">
<dc:Bounds height="17.0" width="86.0" x="1023.0" y="221.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ScriptTask_8" bpmnElement="ScriptTask_8" isExpanded="true">
<dc:Bounds height="50.0" width="110.0" x="360.0" y="328.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_13">
<dc:Bounds height="17.0" width="80.0" x="375.0" y="344.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_ExclusiveGateway_1" bpmnElement="ExclusiveGateway_2" isMarkerVisible="true">
<dc:Bounds height="50.0" width="50.0" x="280.0" y="328.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_5"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BPMNShape_BoundaryEvent_1" bpmnElement="BoundaryEvent_1">
<dc:Bounds height="36.0" width="36.0" x="552.0" y="369.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_16"/>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_1" bpmnElement="SequenceFlow_1" sourceElement="_BPMNShape_StartEvent_7" targetElement="BPMNShape_ScriptTask_2">
<di:waypoint xsi:type="dcoint" x="156.0" y="186.0"/>
<di:waypoint xsi:type="dcoint" x="178.0" y="186.0"/>
<di:waypoint xsi:type="dcoint" x="201.0" y="186.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_18"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_2" bpmnElement="SequenceFlow_2" sourceElement="_BPMNShape_StartEvent_6" targetElement="BPMNShape_ScriptTask_1">
<di:waypoint xsi:type="dcoint" x="136.0" y="503.0"/>
<di:waypoint xsi:type="dcoint" x="163.0" y="503.0"/>
<di:waypoint xsi:type="dcoint" x="163.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="191.0" y="505.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_20"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_4" bpmnElement="SequenceFlow_4" sourceElement="BPMNShape_ScriptTask_1" targetElement="BPMNShape_ExclusiveGateway_1">
<di:waypoint xsi:type="dcoint" x="301.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="305.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="305.0" y="378.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_21"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_7" bpmnElement="SequenceFlow_7" sourceElement="_BPMNShape_ServiceTask_9" targetElement="_BPMNShape_SendTask_2">
<di:waypoint xsi:type="dcoint" x="620.0" y="345.0"/>
<di:waypoint xsi:type="dcoint" x="670.0" y="345.0"/>
<di:waypoint xsi:type="dcoint" x="720.0" y="345.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_23"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_8" bpmnElement="SequenceFlow_8" sourceElement="_BPMNShape_SendTask_2" targetElement="_BPMNShape_EventBasedGateway_2">
<di:waypoint xsi:type="dcoint" x="820.0" y="345.0"/>
<di:waypoint xsi:type="dcoint" x="847.0" y="345.0"/>
<di:waypoint xsi:type="dcoint" x="874.0" y="345.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_24"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_9" bpmnElement="SequenceFlow_9" sourceElement="_BPMNShape_EventBasedGateway_2" targetElement="_BPMNShape_IntermediateCatchEvent_2">
<di:waypoint xsi:type="dcoint" x="899.0" y="320.0"/>
<di:waypoint xsi:type="dcoint" x="899.0" y="229.0"/>
<di:waypoint xsi:type="dcoint" x="937.0" y="229.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_25"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_11" bpmnElement="SequenceFlow_11" sourceElement="_BPMNShape_IntermediateCatchEvent_3" targetElement="BPMNShape_ScriptTask_5">
<di:waypoint xsi:type="dcoint" x="917.0" y="435.0"/>
<di:waypoint xsi:type="dcoint" x="1090.0" y="435.0"/>
<di:waypoint xsi:type="dcoint" x="1264.0" y="435.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_26"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_13" bpmnElement="SequenceFlow_13" sourceElement="BPMNShape_ScriptTask_5" targetElement="_BPMNShape_EndEvent_20">
<di:waypoint xsi:type="dcoint" x="1374.0" y="435.0"/>
<di:waypoint xsi:type="dcoint" x="1497.0" y="435.0"/>
<di:waypoint xsi:type="dcoint" x="1620.0" y="435.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_27"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_15" bpmnElement="SequenceFlow_15" sourceElement="BPMNShape_SubProcess_2" targetElement="_BPMNShape_EndEvent_21">
<di:waypoint xsi:type="dcoint" x="1527.0" y="230.0"/>
<di:waypoint xsi:type="dcoint" x="1567.0" y="230.0"/>
<di:waypoint xsi:type="dcoint" x="1608.0" y="229.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_28"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_16" bpmnElement="SequenceFlow_16" sourceElement="BPMNShape_ScriptTask_3" targetElement="_BPMNShape_SendTask_2">
<di:waypoint xsi:type="dcoint" x="729.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="770.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="770.0" y="385.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_29"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_1" bpmnElement="MessageFlow_1" sourceElement="_BPMNShape_ServiceTask_9" targetElement="_BPMNShape_Participant_7">
<di:waypoint xsi:type="dcoint" x="520.0" y="331.0"/>
<di:waypoint xsi:type="dcoint" x="520.0" y="97.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_30"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_2" bpmnElement="MessageFlow_2" sourceElement="_BPMNShape_Participant_7" targetElement="_BPMNShape_ServiceTask_9">
<di:waypoint xsi:type="dcoint" x="528.0" y="97.0"/>
<di:waypoint xsi:type="dcoint" x="528.0" y="201.0"/>
<di:waypoint xsi:type="dcoint" x="570.0" y="201.0"/>
<di:waypoint xsi:type="dcoint" x="570.0" y="305.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_33"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_4" bpmnElement="MessageFlow_4" sourceElement="_BPMNShape_Participant_7" targetElement="_BPMNShape_IntermediateCatchEvent_2">
<di:waypoint xsi:type="dcoint" x="813.0" y="97.0"/>
<di:waypoint xsi:type="dcoint" x="813.0" y="154.0"/>
<di:waypoint xsi:type="dcoint" x="955.0" y="154.0"/>
<di:waypoint xsi:type="dcoint" x="955.0" y="211.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_34"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_5" bpmnElement="MessageFlow_5" sourceElement="_BPMNShape_Participant_7" targetElement="_BPMNShape_StartEvent_6">
<di:waypoint xsi:type="dcoint" x="118.0" y="97.0"/>
<di:waypoint xsi:type="dcoint" x="118.0" y="485.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_37"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_6" bpmnElement="MessageFlow_6" sourceElement="_BPMNShape_Participant_7" targetElement="_BPMNShape_StartEvent_7">
<di:waypoint xsi:type="dcoint" x="138.0" y="97.0"/>
<di:waypoint xsi:type="dcoint" x="138.0" y="168.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_38"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_MessageFlow_3" bpmnElement="MessageFlow_3" sourceElement="_BPMNShape_SendTask_2" targetElement="_BPMNShape_Participant_7">
<di:waypoint xsi:type="dcoint" x="770.0" y="305.0"/>
<di:waypoint xsi:type="dcoint" x="770.0" y="201.0"/>
<di:waypoint xsi:type="dcoint" x="770.0" y="97.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_39"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_18" bpmnElement="SequenceFlow_18" sourceElement="BPMNShape_StartEvent_1" targetElement="BPMNShape_ScriptTask_6">
<di:waypoint xsi:type="dcoint" x="1222.0" y="235.0"/>
<di:waypoint xsi:type="dcoint" x="1249.0" y="235.0"/>
<di:waypoint xsi:type="dcoint" x="1276.0" y="235.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_40"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_19" bpmnElement="SequenceFlow_19" sourceElement="BPMNShape_ScriptTask_6" targetElement="BPMNShape_EndEvent_1">
<di:waypoint xsi:type="dcoint" x="1386.0" y="235.0"/>
<di:waypoint xsi:type="dcoint" x="1411.0" y="235.0"/>
<di:waypoint xsi:type="dcoint" x="1436.0" y="235.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_41"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_12" bpmnElement="SequenceFlow_12" sourceElement="_BPMNShape_IntermediateCatchEvent_2" targetElement="BPMNShape_ScriptTask_4">
<di:waypoint xsi:type="dcoint" x="973.0" y="229.0"/>
<di:waypoint xsi:type="dcoint" x="992.0" y="229.0"/>
<di:waypoint xsi:type="dcoint" x="1011.0" y="230.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_42"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_17" bpmnElement="SequenceFlow_17" sourceElement="BPMNShape_ScriptTask_4" targetElement="BPMNShape_SubProcess_2">
<di:waypoint xsi:type="dcoint" x="1121.0" y="230.0"/>
<di:waypoint xsi:type="dcoint" x="1138.0" y="230.0"/>
<di:waypoint xsi:type="dcoint" x="1156.0" y="230.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_43"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_22" bpmnElement="SequenceFlow_22" sourceElement="_BPMNShape_EventBasedGateway_2" targetElement="_BPMNShape_IntermediateCatchEvent_3">
<di:waypoint xsi:type="dcoint" x="899.0" y="370.0"/>
<di:waypoint xsi:type="dcoint" x="899.0" y="393.0"/>
<di:waypoint xsi:type="dcoint" x="899.0" y="417.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_44"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_23" bpmnElement="SequenceFlow_23" sourceElement="BPMNShape_ExclusiveGateway_1" targetElement="BPMNShape_ScriptTask_8">
<di:waypoint xsi:type="dcoint" x="330.0" y="353.0"/>
<di:waypoint xsi:type="dcoint" x="345.0" y="353.0"/>
<di:waypoint xsi:type="dcoint" x="360.0" y="353.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_45"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_20" bpmnElement="SequenceFlow_20" sourceElement="BPMNShape_ScriptTask_2" targetElement="BPMNShape_ExclusiveGateway_1">
<di:waypoint xsi:type="dcoint" x="256.0" y="211.0"/>
<di:waypoint xsi:type="dcoint" x="256.0" y="353.0"/>
<di:waypoint xsi:type="dcoint" x="280.0" y="353.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_46"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_6" bpmnElement="SequenceFlow_6" sourceElement="BPMNShape_ScriptTask_8" targetElement="_BPMNShape_ServiceTask_9">
<di:waypoint xsi:type="dcoint" x="470.0" y="353.0"/>
<di:waypoint xsi:type="dcoint" x="495.0" y="353.0"/>
<di:waypoint xsi:type="dcoint" x="495.0" y="358.0"/>
<di:waypoint xsi:type="dcoint" x="520.0" y="358.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_17"/>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_3" bpmnElement="SequenceFlow_3" sourceElement="BPMNShape_BoundaryEvent_1" targetElement="BPMNShape_ScriptTask_3">
<di:waypoint xsi:type="dcoint" x="570.0" y="405.0"/>
<di:waypoint xsi:type="dcoint" x="570.0" y="505.0"/>
<di:waypoint xsi:type="dcoint" x="619.0" y="505.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_47"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
<dc:Font name="arial" size="9.0"/>
</bpmndi:BPMNLabelStyle>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>
Solved! Go to Solution.
Hi,
I had a detailed look at your post today.
I don't think timer, event and signal boundary events work on script/services/camel tasks in Activiti...not sure if it is by design or a defect! Feel free to raise an issue or even a contribution (which would be great!) assuming it is valid as per BPMN 2.0 spec. This is probably the main reason why you not able to trigger a signal attached to your Camel task.
Regarding the async setting I mentioned, assume that Activiti supported boundary signals/messages on Camel task, then I would expect those message/signal subscription to work only after the activity it is attached to is persisted to database (which is essentially controlled by the setting of async flag explained at https://activiti.github.io/userguide/5.19.0/index.html#asyncContinuations).
Is your camel task a very long running task? If that is the only reason for a boundary event, you can achieve that using a Camel + Receive Task pattern as explained in the user guide https://activiti.github.io/userguide/5.19.0/index.html#bpmnCamelTask.
A normal Camel + Receive Task pattern that is used in the following test cases in Activiti are working fine
https://github.com/Activiti/Activiti/blob/5.x/modules/activiti-camel/src/test/java/org/activiti/came...
https://github.com/Activiti/Activiti/blob/5.x/modules/activiti-camel/src/test/java/org/activiti/came...
With the above pattern, I was hoping that I can include a boundary signal on the receive task if I want to terminate it using external signals...However there appears an issue when there are boundary events on those receive tasks. Looks like the Camel Behavior in Activiti is not completing the boundary events when Receive Tasks are completed...
Feel free to raise an issue on this in Activiti. Btw, until this issue is fixed, you might be able to achieve similar external signaling + camel signaling functionality by altering the process model a bit. Please find attached the project I used to test these behaviors. Hope this helps!
runtimeService.createExecutionQuery().signalEventSubscriptionName(signalName) is the correct way to query for active executions..however it looks strange to have an signal boundary event on a sync service task. May be I didn't understand your use case here... Are you expecting to send a message in the service task and want to wait for a signal in the same task? Do you have any unit tests that I can run to reproduce the issue on my end?
Ciju
In this case, the synchronous service task is a call to a camel route , and the route can terminate by sending a signal and therefore trigger the boundary event to perform a custom action defined in the script task . Or the camel route can end nominally and the workflow continue.
I join a test case that illustrate the issue.
The thing to do is to put a breakpoint in the sendSignal method , and you'll see that the execution resulting of the query is null.
And the execution result of the query only on the processInstanceId contain the scopeExecution object that contains the boundarySignalDefinition of the signal.
Thanks ,
Jean-Philippe
Hi Jean-Philippe,
Thank you for the sample process and test case. From a quick look at the xml and your use case, it makes sense to follow the async pattern as explained here. The query apis are basically querying the database and since your service task is configured as "sync", the entry will not be in the database until the process reaches the next wait state...This is probably why your execution query is returning null.
I'll check out your test case and example in detail when I get a few minutes.
Ciju
Hi Ciju,
Thanks for your answer, I tried with the activiti:async="true" on the service task but still the same result.
I could use other way to achieve what I want , but I just want to prove if it's possible to trigger a boundary event from a camel route.
Since the first script task is async , I don't think this is an issue about async pattern.
Jean-Philippe
Hi,
I had a detailed look at your post today.
I don't think timer, event and signal boundary events work on script/services/camel tasks in Activiti...not sure if it is by design or a defect! Feel free to raise an issue or even a contribution (which would be great!) assuming it is valid as per BPMN 2.0 spec. This is probably the main reason why you not able to trigger a signal attached to your Camel task.
Regarding the async setting I mentioned, assume that Activiti supported boundary signals/messages on Camel task, then I would expect those message/signal subscription to work only after the activity it is attached to is persisted to database (which is essentially controlled by the setting of async flag explained at https://activiti.github.io/userguide/5.19.0/index.html#asyncContinuations).
Is your camel task a very long running task? If that is the only reason for a boundary event, you can achieve that using a Camel + Receive Task pattern as explained in the user guide https://activiti.github.io/userguide/5.19.0/index.html#bpmnCamelTask.
A normal Camel + Receive Task pattern that is used in the following test cases in Activiti are working fine
https://github.com/Activiti/Activiti/blob/5.x/modules/activiti-camel/src/test/java/org/activiti/came...
https://github.com/Activiti/Activiti/blob/5.x/modules/activiti-camel/src/test/java/org/activiti/came...
With the above pattern, I was hoping that I can include a boundary signal on the receive task if I want to terminate it using external signals...However there appears an issue when there are boundary events on those receive tasks. Looks like the Camel Behavior in Activiti is not completing the boundary events when Receive Tasks are completed...
Feel free to raise an issue on this in Activiti. Btw, until this issue is fixed, you might be able to achieve similar external signaling + camel signaling functionality by altering the process model a bit. Please find attached the project I used to test these behaviors. Hope this helps!
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.