<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_0fqpje6" targetNamespace="http://bpmn.io/schema/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="7.2.0">
  <bpmn:collaboration id="Collaboration_0q44ppb">
    <bpmn:participant id="Participant_0zpon3h" processRef="Process_1so81jg" />
  </bpmn:collaboration>
  <bpmn:process id="Process_1so81jg" isExecutable="false">
    <bpmn:startEvent id="StartEvent_1ohx91b">
      <bpmn:extensionElements>
        <camunda:executionListener event="start">
          <camunda:script scriptFormat="JavaScript">console.log("This is the start event");
          this.token.appendData({records:[1,2,3,4,5]});
          console.log('=====from script',this.token.data);
          this.log("====This is the start event");</camunda:script>
        </camunda:executionListener>
      </bpmn:extensionElements>
      <bpmn:outgoing>Flow_18xinq3</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:scriptTask id="script_task" name="Script Task" scriptFormat="JavaScript">
      <bpmn:incoming>Flow_18xinq3</bpmn:incoming>
      <bpmn:outgoing>Flow_0xpjff0</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics isSequential="true" camunda:collection="$(item.data.records)" />
      <bpmn:script>this.log('this is a script task'+item.seq);</bpmn:script>
    </bpmn:scriptTask>
    <bpmn:serviceTask id="service_task" name="Service Task" camunda:delegateExpression="serviceX">
      <bpmn:incoming>Flow_0xpjff0</bpmn:incoming>
      <bpmn:outgoing>Flow_0s8ghrk</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics camunda:collection="$(this.data.records)" />
    </bpmn:serviceTask>
    <bpmn:endEvent id="Event_0bf16wv">
      <bpmn:incoming>Flow_1qyp7h6</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0s8ghrk" sourceRef="service_task" targetRef="SubProcess" />
    <bpmn:sequenceFlow id="Flow_0xpjff0" sourceRef="script_task" targetRef="service_task" />
    <bpmn:sequenceFlow id="Flow_18xinq3" sourceRef="StartEvent_1ohx91b" targetRef="script_task" />
    <bpmn:subProcess id="SubProcess" name="SubProcess">
      <bpmn:incoming>Flow_0s8ghrk</bpmn:incoming>
      <bpmn:outgoing>Flow_1qyp7h6</bpmn:outgoing>
      <bpmn:multiInstanceLoopCharacteristics camunda:collection="[&#39;A&#39;,&#39;B&#39;,&#39;C&#39;]" />
      <bpmn:startEvent id="Event_0an0xl3">
        <bpmn:outgoing>Flow_09jx33a</bpmn:outgoing>
      </bpmn:startEvent>
      <bpmn:sequenceFlow id="Flow_09jx33a" sourceRef="Event_0an0xl3" targetRef="Activity_1lzds0i" />
      <bpmn:endEvent id="Event_1j62ljq">
        <bpmn:incoming>Flow_0yr8zl8</bpmn:incoming>
      </bpmn:endEvent>
      <bpmn:sequenceFlow id="Flow_0yr8zl8" sourceRef="Activity_1lzds0i" targetRef="Event_1j62ljq" />
      <bpmn:scriptTask id="Activity_1lzds0i" name="script">
        <bpmn:incoming>Flow_09jx33a</bpmn:incoming>
        <bpmn:outgoing>Flow_0yr8zl8</bpmn:outgoing>
        <bpmn:multiInstanceLoopCharacteristics isSequential="true" camunda:collection="[&#39;S1&#39;,&#39;S2&#39;,&#39;S3&#39;]" />
      </bpmn:scriptTask>
    </bpmn:subProcess>
    <bpmn:sequenceFlow id="Flow_1qyp7h6" sourceRef="SubProcess" targetRef="Event_0bf16wv" />
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0q44ppb">
      <bpmndi:BPMNShape id="Participant_0zpon3h_di" bpmnElement="Participant_0zpon3h" isHorizontal="true">
        <dc:Bounds x="180" y="0" width="664" height="510" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_1qyp7h6_di" bpmnElement="Flow_1qyp7h6">
        <di:waypoint x="614" y="280" />
        <di:waypoint x="614" y="201" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_18xinq3_di" bpmnElement="Flow_18xinq3">
        <di:waypoint x="268" y="183" />
        <di:waypoint x="294" y="183" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="212" y="129" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0xpjff0_di" bpmnElement="Flow_0xpjff0">
        <di:waypoint x="394" y="183" />
        <di:waypoint x="419" y="183" />
        <di:waypoint x="419" y="183" />
        <di:waypoint x="439" y="183" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="365" y="144" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0s8ghrk_di" bpmnElement="Flow_0s8ghrk">
        <di:waypoint x="489" y="223" />
        <di:waypoint x="489" y="280" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="498.5" y="129" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1ohx91b">
        <dc:Bounds x="232" y="165" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="181" y="172" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="script_task_di" bpmnElement="script_task">
        <dc:Bounds x="294" y="143" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="service_task_di" bpmnElement="service_task">
        <dc:Bounds x="439" y="143" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0bf16wv_di" bpmnElement="Event_0bf16wv">
        <dc:Bounds x="596" y="165" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="545" y="172" width="90" height="20" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0ej3q6j_di" bpmnElement="SubProcess" isExpanded="true">
        <dc:Bounds x="314" y="280" width="350" height="200" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge id="Flow_0yr8zl8_di" bpmnElement="Flow_0yr8zl8">
        <di:waypoint x="530" y="380" />
        <di:waypoint x="582" y="380" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_09jx33a_di" bpmnElement="Flow_09jx33a">
        <di:waypoint x="378" y="380" />
        <di:waypoint x="430" y="380" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="Event_0an0xl3_di" bpmnElement="Event_0an0xl3">
        <dc:Bounds x="342" y="362" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1j62ljq_di" bpmnElement="Event_1j62ljq">
        <dc:Bounds x="582" y="362" width="36" height="36" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_08mjzw4_di" bpmnElement="Activity_1lzds0i">
        <dc:Bounds x="430" y="340" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>
