Process doesn't seem to receive signal event
chrismarm Apr 9, 2014 11:22 AMHi everyone
I've been testing some simple use cases in jBPM v6.0.1 with processes created in Eclipse using Modeler plugin. In order to test signals, I designed the following simple process:
The generated XML code for this process is:
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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:tns="http://www.jboss.org/drools" xmlns="http://www.jboss.org/drools" 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="Definition" expressionLanguage="http://www.mvel.org/2.0" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<bpmn2:signal id="Signal_1" name="TheSignal"/>
<bpmn2:process id="com.mycompany.concepts.PruebaBPMN2" tns:version="1" tns:packageName="com.mycompany.concepts" tns:adHoc="false" name="PruebaBPMN2" isExecutable="true" processType="Private">
<bpmn2:startEvent id="StartEvent_1" name="StartProcess">
<bpmn2:outgoing>SequenceFlow_2</bpmn2:outgoing>
</bpmn2:startEvent>
<bpmn2:endEvent id="EndEvent_1" name="">
<bpmn2:incoming>SequenceFlow_4</bpmn2:incoming>
<bpmn2:terminateEventDefinition id="TerminateEventDefinition_1"/>
</bpmn2:endEvent>
<bpmn2:sequenceFlow id="SequenceFlow_2" tns:priority="1" name="" sourceRef="StartEvent_1" targetRef="IntermediateCatchEvent_1"/>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_1" name="SignalNode">
<bpmn2:incoming>SequenceFlow_2</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_4</bpmn2:outgoing>
<bpmn2:signalEventDefinition id="SignalEventDefinition_1" signalRef="Signal_1"/>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="SequenceFlow_4" tns:priority="1" name="" sourceRef="IntermediateCatchEvent_1" targetRef="EndEvent_1"/>
</bpmn2:process>
The following JUnit test fails at the second assert:
@Test
public void test() {
RuntimeManager manager = createRuntimeManager("PruebaBPMN2.bpmn2");
RuntimeEngine engine = getRuntimeEngine(null);
KieSession ksession = engine.getKieSession();
ProcessInstance processInstance = ksession.startProcess("com.mycompany.concepts.PruebaBPMN2");
assertProcessInstanceActive(processInstance.getId(), ksession);
ksession.signalEvent("TheSignal", null);
assertProcessInstanceCompleted(processInstance.getId(), ksession);
manager.disposeRuntimeEngine(engine);
manager.close();
}
This indicates that the process instance hasn't received the signal called "TheSignal" and it never ends. However, by changing:
ksession.signalEvent("Signal_1", null);
the test runs successfully.
Could anyone explain why the first test isn't working? If I deploy and create an instance of this same process in the jBPM console, and then sends a signal called "TheSignal", the process receives the signal properly and comes to an end.
Thanks in advance.
Christian