AnsweredAssumed Answered

The User Task after Intermediate Signaling Catch Event is not available

Question asked by chanjar on Sep 15, 2014
Latest reply on Sep 16, 2014 by chanjar
Hi,

I'm doing some practice with Activiti and got stuck with the following problem:

The User Task after Intermediate Signaling Catch Event is not available.

Below is the Activiti diagram xml file and java code:


<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 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" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.chanjar.me" id="adhoc-definitions">
  <signal id="def" name="def"></signal>
  <signal id="def2" name="def2"></signal>
  <process id="event-intermediate-signal-throw-event" name="event-intermediate-signal-throw-event" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <intermediateThrowEvent id="signalintermediatethrowevent1" name="SignalThrowEvent">
      <signalEventDefinition signalRef="def"></signalEventDefinition>
    </intermediateThrowEvent>
    <userTask id="usertask1" name="usertask1"></userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="usertask1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="usertask1" targetRef="signalintermediatethrowevent1"></sequenceFlow>
    <intermediateCatchEvent id="signalintermediatecatchevent2" name="SignalCatchEvent">
      <signalEventDefinition signalRef="def"></signalEventDefinition>
    </intermediateCatchEvent>
    <sequenceFlow id="flow4" sourceRef="signalintermediatecatchevent2" targetRef="usertask2"></sequenceFlow>
    <userTask id="usertask2" name="usertask2"></userTask>
    <sequenceFlow id="flow5" sourceRef="usertask2" targetRef="endevent1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow6" sourceRef="signalintermediatethrowevent1" targetRef="signalintermediatecatchevent2"></sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_event-intermediate-signal-throw-event">
    <bpmndi:BPMNPlane bpmnElement="event-intermediate-signal-throw-event" id="BPMNPlane_event-intermediate-signal-throw-event">
      <bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="10.0" y="168.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="signalintermediatethrowevent1" id="BPMNShape_signalintermediatethrowevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="245.0" y="168.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="96.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="signalintermediatecatchevent2" id="BPMNShape_signalintermediatecatchevent2">
        <omgdc:Bounds height="35.0" width="35.0" x="330.0" y="168.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="usertask2" id="BPMNShape_usertask2">
        <omgdc:Bounds height="55.0" width="105.0" x="420.0" y="158.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endevent1" id="BPMNShape_endevent1">
        <omgdc:Bounds height="35.0" width="35.0" x="590.0" y="168.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="flow1" id="BPMNEdge_flow1">
        <omgdi:waypoint x="45.0" y="185.0"></omgdi:waypoint>
        <omgdi:waypoint x="96.0" y="185.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow2" id="BPMNEdge_flow2">
        <omgdi:waypoint x="201.0" y="185.0"></omgdi:waypoint>
        <omgdi:waypoint x="245.0" y="185.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4">
        <omgdi:waypoint x="365.0" y="185.0"></omgdi:waypoint>
        <omgdi:waypoint x="420.0" y="185.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5">
        <omgdi:waypoint x="525.0" y="185.0"></omgdi:waypoint>
        <omgdi:waypoint x="590.0" y="185.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge bpmnElement="flow6" id="BPMNEdge_flow6">
        <omgdi:waypoint x="280.0" y="185.0"></omgdi:waypoint>
        <omgdi:waypoint x="330.0" y="185.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>


task2 is always null


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:springTypicalUsageTest-context.xml")
public class EventTest {
   
    @Autowired
    private RuntimeService runtimeService;
   
    @Autowired
    private TaskService taskService;
   
    @Autowired
    @Rule
    public ActivitiRule activitiSpringRule;
   
    @Test
    @Deployment(resources="me/chanjar/event-intermediate-signal-throw-event.bpmn")
    public void intermediateSignalThrowEvent() {
      String processDefinitionKey = "event-intermediate-signal-throw-event";
      runtimeService.startProcessInstanceByKey(processDefinitionKey);

      Task task = taskService.createTaskQuery().processDefinitionKey(processDefinitionKey).taskDefinitionKey("usertask1").singleResult();
      taskService.complete(task.getId());
     
      Task task2 = taskService.createTaskQuery().processDefinitionKey(processDefinitionKey).taskDefinitionKey("usertask2").singleResult();
      // task2 is always null
      taskService.complete(task2.getId());
    
    } 
}

Outcomes