I have simple two process definition which has a user task with listeners that correlates a message. We have a non-interrupting boundary event attached to them, which receives the message. I have two identical process definition; one is able to run while the other isn’t.
When looking through event-subscriptions REST-API, I am able to see the second process def (working one) creates a message receiver subscription and that goes away after the process is completed.
I get the following error when trying to start process instance:
Cannot instantiate process definition <id>: ENGINE-03051 There was an exception while invoking the TaskListener. Message: 'Unable to evaluate script while executing activity <id> in the process definition with id <id>: org.camunda.bpm.engine.MismatchingMessageCorrelationException: Cannot correlate message <id>: No process definition or execution matches the parameters' [ start-instance-error ]
Not working process def:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1dn4t92" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="sendExpNotification" name="sendExpNotification" isExecutable="true">
<bpmn:startEvent id="mainStart">
<bpmn:outgoing>start_user_task</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="start_user_task" sourceRef="mainStart" targetRef="userTask" />
<bpmn:userTask id="userTask" name="Task #1" camunda:assignee="Distanta">
<bpmn:extensionElements>
<camunda:taskListener event="assignment">
<camunda:script scriptFormat="groovy">task.getExecution().getProcessEngineServices().getRuntimeService().createMessageCorrelation("sendEmail130").processInstanceId(task.getProcessInstanceId()).setVariable("taskId",task.getId()).setVariable("assignee","947adce5-2ae2-4877-8201-1bb6518da080").setVariable("heading","camunda test").setVariable("message","camunda test test").setVariable("icon","requirements").correlate();</camunda:script>
</camunda:taskListener>
<camunda:taskListener event="complete">
<camunda:script scriptFormat="groovy">task.getExecution().getProcessEngineServices().getRuntimeService().createMessageCorrelation("sendEmail130").processInstanceId(task.getProcessInstanceId()).setVariable("taskId",task.getId()).setVariable("assignee","947adce5-2ae2-4877-8201-1bb6518da080").setVariable("heading","camunda test").setVariable("message","camunda test test").setVariable("icon","requirements").correlate();</camunda:script>
</camunda:taskListener>
</bpmn:extensionElements>
<bpmn:incoming>start_user_task</bpmn:incoming>
<bpmn:outgoing>user_task_end</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="branch_end">
<bpmn:incoming>service_end</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="boundary_service" sourceRef="messageBoundry" targetRef="service" />
<bpmn:boundaryEvent id="messageBoundry" cancelActivity="false" attachedToRef="userTask">
<bpmn:outgoing>boundary_service</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_0en192e" messageRef="Message_0fc2f1r" />
</bpmn:boundaryEvent>
<bpmn:sequenceFlow id="user_task_end" sourceRef="userTask" targetRef="mainEnd" />
<bpmn:endEvent id="mainEnd">
<bpmn:incoming>user_task_end</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="service_end" sourceRef="service" targetRef="branch_end" />
<bpmn:serviceTask id="service" name="sendExpreienceNotification" camunda:type="external" camunda:topic="maestro-experience-notification">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="icon">${icon}</camunda:inputParameter>
<camunda:inputParameter name="message">${message}</camunda:inputParameter>
<camunda:inputParameter name="taskId">${taskId}</camunda:inputParameter>
<camunda:inputParameter name="heading">${heading}</camunda:inputParameter>
<camunda:inputParameter name="assignee">${assignee}</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>boundary_service</bpmn:incoming>
<bpmn:outgoing>service_end</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmn:message id="Message_0fc2f1r" name="sendEmail130" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="sendExpNotification">
<bpmndi:BPMNEdge id="Flow_1cga36h_di" bpmnElement="service_end">
<di:waypoint x="370" y="270" />
<di:waypoint x="592" y="270" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_03aul94_di" bpmnElement="user_task_end">
<di:waypoint x="390" y="117" />
<di:waypoint x="592" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_13xfc42_di" bpmnElement="boundary_service">
<di:waypoint x="320" y="175" />
<di:waypoint x="320" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_02jvlga_di" bpmnElement="start_user_task">
<di:waypoint x="215" y="117" />
<di:waypoint x="290" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="mainStart">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0yegqsq_di" bpmnElement="userTask">
<dc:Bounds x="290" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_00q3joz_di" bpmnElement="branch_end">
<dc:Bounds x="592" y="252" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0tqg0fg_di" bpmnElement="mainEnd">
<dc:Bounds x="592" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0yvzvw6_di" bpmnElement="service">
<dc:Bounds x="270" y="230" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_14m5xrt_di" bpmnElement="messageBoundry">
<dc:Bounds x="302" y="139" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Working process def:
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="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:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_1dn4t92" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.11.1" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
<bpmn:process id="boundaryEventAssignmentTaskTrigger" name="Boundary Event Assignment Task Trigger" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_02jvlga</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_02jvlga" sourceRef="StartEvent_1" targetRef="Activity_0yegqsq" />
<bpmn:userTask id="Activity_0yegqsq" name="Task #1">
<bpmn:extensionElements>
<camunda:taskListener event="assignment">
<camunda:script scriptFormat="groovy">task.getExecution().getProcessEngineServices().getRuntimeService().createMessageCorrelation("sendEmail145").processInstanceId(task.getProcessInstanceId()).setVariable("taskId",task.getId()).setVariable("assignee","947adce5-2ae2-4877-8201-1bb6518da080").setVariable("heading","camunda test").setVariable("message","camunda test test").setVariable("icon","requirements").correlate();</camunda:script>
</camunda:taskListener>
<camunda:taskListener event="complete">
<camunda:script scriptFormat="groovy">task.getExecution().getProcessEngineServices().getRuntimeService().createMessageCorrelation("sendEmail145").processInstanceId(task.getProcessInstanceId()).setVariable("taskId",task.getId()).setVariable("assignee","947adce5-2ae2-4877-8201-1bb6518da080").setVariable("heading","camunda test").setVariable("message","camunda test test").setVariable("icon","requirements").correlate();</camunda:script>
</camunda:taskListener>
</bpmn:extensionElements>
<bpmn:incoming>Flow_02jvlga</bpmn:incoming>
<bpmn:outgoing>Flow_03aul94</bpmn:outgoing>
</bpmn:userTask>
<bpmn:endEvent id="Event_00q3joz">
<bpmn:incoming>Flow_1cga36h</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_13xfc42" sourceRef="Event_14m5xrt" targetRef="Activity_0x0axpg" />
<bpmn:boundaryEvent id="Event_14m5xrt" cancelActivity="false" attachedToRef="Activity_0yegqsq">
<bpmn:outgoing>Flow_13xfc42</bpmn:outgoing>
<bpmn:messageEventDefinition id="MessageEventDefinition_0en192e" messageRef="Message_0fc2f1r" />
</bpmn:boundaryEvent>
<bpmn:sequenceFlow id="Flow_03aul94" sourceRef="Activity_0yegqsq" targetRef="Event_0tqg0fg" />
<bpmn:endEvent id="Event_0tqg0fg">
<bpmn:incoming>Flow_03aul94</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_1cga36h" sourceRef="Activity_0x0axpg" targetRef="Event_00q3joz" />
<bpmn:serviceTask id="Activity_0x0axpg" name="Task #2" camunda:type="external" camunda:topic="maestro-experience-notification">
<bpmn:extensionElements>
<camunda:inputOutput>
<camunda:inputParameter name="icon">${icon}</camunda:inputParameter>
<camunda:inputParameter name="message">${message}</camunda:inputParameter>
<camunda:inputParameter name="heading">${heading}</camunda:inputParameter>
<camunda:inputParameter name="taskId">${taskId}</camunda:inputParameter>
<camunda:inputParameter name="assignee">${assignee}</camunda:inputParameter>
</camunda:inputOutput>
</bpmn:extensionElements>
<bpmn:incoming>Flow_13xfc42</bpmn:incoming>
<bpmn:outgoing>Flow_1cga36h</bpmn:outgoing>
</bpmn:serviceTask>
</bpmn:process>
<bpmn:message id="Message_0fc2f1r" name="sendEmail145" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="boundaryEventAssignmentTaskTrigger">
<bpmndi:BPMNEdge id="Flow_1cga36h_di" bpmnElement="Flow_1cga36h">
<di:waypoint x="370" y="270" />
<di:waypoint x="592" y="270" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_03aul94_di" bpmnElement="Flow_03aul94">
<di:waypoint x="390" y="117" />
<di:waypoint x="592" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_13xfc42_di" bpmnElement="Flow_13xfc42">
<di:waypoint x="320" y="175" />
<di:waypoint x="320" y="230" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_02jvlga_di" bpmnElement="Flow_02jvlga">
<di:waypoint x="215" y="117" />
<di:waypoint x="290" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0yegqsq_di" bpmnElement="Activity_0yegqsq">
<dc:Bounds x="290" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_00q3joz_di" bpmnElement="Event_00q3joz">
<dc:Bounds x="592" y="252" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0tqg0fg_di" bpmnElement="Event_0tqg0fg">
<dc:Bounds x="592" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_181d9l4_di" bpmnElement="Activity_0x0axpg">
<dc:Bounds x="270" y="230" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_14m5xrt_di" bpmnElement="Event_14m5xrt">
<dc:Bounds x="302" y="139" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>