Service task flow gone wrong - camunda bpmn

I am working on the below simple logic

<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0"> <bpmn:process id="mail" name="Mail" isExecutable="true"> <bpmn:extensionElements> <camunda:executionListener class="org.camunda.bpm.twitter.TwitterService" event="start" /> </bpmn:extensionElements> <bpmn:startEvent id="mail_start" name="Mail Start" camunda:initiator="requestor"> <bpmn:extensionElements> <camunda:formData> <camunda:formField id="mail_message" label="Message" type="string" /> </camunda:formData> </bpmn:extensionElements> <bpmn:outgoing>SequenceFlow_04sgxou</bpmn:outgoing> </bpmn:startEvent> <bpmn:endEvent id="end_mail" name="End Mail"> <bpmn:incoming>SequenceFlow_1s6xts7</bpmn:incoming> </bpmn:endEvent> <bpmn:sequenceFlow id="SequenceFlow_04sgxou" sourceRef="mail_start" targetRef="mail_approver" /> <bpmn:userTask id="mail_approver" name="Approver" camunda:assignee="john"> <bpmn:extensionElements> <camunda:formData> <camunda:formField id="mail_approve" label="do you approve?" type="boolean" /> </camunda:formData> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_04sgxou</bpmn:incoming> <bpmn:incoming>SequenceFlow_0fgtj7h</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0gxvhe5</bpmn:outgoing> </bpmn:userTask> <bpmn:exclusiveGateway id="approver_gateway" name="approve?"> <bpmn:incoming>SequenceFlow_0gxvhe5</bpmn:incoming> <bpmn:outgoing>approve_yes</bpmn:outgoing> <bpmn:outgoing>approve_no</bpmn:outgoing> </bpmn:exclusiveGateway> <bpmn:sequenceFlow id="SequenceFlow_0gxvhe5" sourceRef="mail_approver" targetRef="approver_gateway" /> <bpmn:sequenceFlow id="approve_yes" name="Yes" sourceRef="approver_gateway" targetRef="mail_logic"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${ mail_approve == true }</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:sequenceFlow id="approve_no" name="No" sourceRef="approver_gateway" targetRef="mail_correction"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${ mail_approve == false }</bpmn:conditionExpression> </bpmn:sequenceFlow> <bpmn:userTask id="mail_correction" name="Correction" camunda:assignee="${requestor}"> <bpmn:extensionElements> <camunda:formData> <camunda:formField id="mail_message" label="Message" type="string" /> </camunda:formData> </bpmn:extensionElements> <bpmn:incoming>approve_no</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0fgtj7h</bpmn:outgoing> </bpmn:userTask> <bpmn:sequenceFlow id="SequenceFlow_0fgtj7h" sourceRef="mail_correction" targetRef="mail_approver" /> <bpmn:serviceTask id="mail_logic" name="Business Logic" camunda:class="org.camunda.bpm.mail.MailerService"> <bpmn:incoming>approve_yes</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1s6xts7</bpmn:outgoing> </bpmn:serviceTask> <bpmn:sequenceFlow id="SequenceFlow_1s6xts7" sourceRef="mail_logic" targetRef="end_mail" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="mail"> <bpmndi:BPMNShape id="StartEvent_00nx4d0_di" bpmnElement="mail_start"> <dc:Bounds x="203" y="72" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="199" y="108" width="44" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="EndEvent_0ar4d5p_di" bpmnElement="end_mail"> <dc:Bounds x="638" y="72" width="36" height="36" /> <bpmndi:BPMNLabel> <dc:Bounds x="636" y="108" width="39" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_04sgxou_di" bpmnElement="SequenceFlow_04sgxou"> <di:waypoint xsi:type="dc:Point" x="239" y="90" /> <di:waypoint xsi:type="dc:Point" x="267" y="90" /> <bpmndi:BPMNLabel> <dc:Bounds x="253" y="75" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="UserTask_0lzu4ha_di" bpmnElement="mail_approver"> <dc:Bounds x="267" y="50" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ExclusiveGateway_1p0k1ov_di" bpmnElement="approver_gateway" isMarkerVisible="true"> <dc:Bounds x="397" y="65" width="50" height="50" /> <bpmndi:BPMNLabel> <dc:Bounds x="399" y="36" width="46" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0gxvhe5_di" bpmnElement="SequenceFlow_0gxvhe5"> <di:waypoint xsi:type="dc:Point" x="367" y="90" /> <di:waypoint xsi:type="dc:Point" x="397" y="90" /> <bpmndi:BPMNLabel> <dc:Bounds x="382" y="65" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0k036l6_di" bpmnElement="approve_yes"> <di:waypoint xsi:type="dc:Point" x="447" y="90" /> <di:waypoint xsi:type="dc:Point" x="491" y="90" /> <bpmndi:BPMNLabel> <dc:Bounds x="459" y="65" width="19" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_0h0ktm6_di" bpmnElement="approve_no"> <di:waypoint xsi:type="dc:Point" x="422" y="115" /> <di:waypoint xsi:type="dc:Point" x="422" y="233" /> <di:waypoint xsi:type="dc:Point" x="367" y="233" /> <bpmndi:BPMNLabel> <dc:Bounds x="430" y="174" width="13" height="10" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="UserTask_1vt035q_di" bpmnElement="mail_correction"> <dc:Bounds x="267" y="193" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_0fgtj7h_di" bpmnElement="SequenceFlow_0fgtj7h"> <di:waypoint xsi:type="dc:Point" x="317" y="193" /> <di:waypoint xsi:type="dc:Point" x="317" y="130" /> <bpmndi:BPMNLabel> <dc:Bounds x="332" y="151.5" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> <bpmndi:BPMNShape id="ServiceTask_0a501tz_di" bpmnElement="mail_logic"> <dc:Bounds x="491" y="50" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNEdge id="SequenceFlow_1s6xts7_di" bpmnElement="SequenceFlow_1s6xts7"> <di:waypoint xsi:type="dc:Point" x="591" y="90" /> <di:waypoint xsi:type="dc:Point" x="638" y="90" /> <bpmndi:BPMNLabel> <dc:Bounds x="615" y="75" width="0" height="0" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions>

Problem is my service task get initiate at the time of start process itself(very beginning - start process). it does not depend my exclusive gateway.

it is the default behavior or am I doing something wrong?

Can you post the entire BPMN xml file?

@Niall can you please review my updated question

You seem to have an execution listener on your model which would run the org.camunda.bpm.twitter.TwitterService class at the begining of the process.

To see it - select the canvas and take a look at the “listeners” tab on the properties panel. this could be the thing that you’re running.

1 Like

thanks for giving idea to check in file. yeah! you right that is the culprit.