Sorry, i still very confusion according my invest.
I create mock process to research the variable issue, the process is
<?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:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_10gb0at" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Zeebe Modeler" exporterVersion="0.9.1">
<bpmn:process id="mock-process" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_0ulicn4</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_0ulicn4" sourceRef="StartEvent_1" targetRef="Activity_1kujh3x" />
<bpmn:endEvent id="Event_12hj9nh">
<bpmn:incoming>Flow_0reym0t</bpmn:incoming>
</bpmn:endEvent>
<bpmn:serviceTask id="Activity_1kujh3x" name="just a mock">
<bpmn:extensionElements>
<zeebe:taskDefinition type="MockCommand" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_0ulicn4</bpmn:incoming>
<bpmn:outgoing>Flow_17a0th4</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:subProcess id="Activity_0hl51m6">
<bpmn:incoming>Flow_17a0th4</bpmn:incoming>
<bpmn:outgoing>Flow_0reym0t</bpmn:outgoing>
<bpmn:multiInstanceLoopCharacteristics>
<bpmn:extensionElements>
<zeebe:loopCharacteristics inputCollection="= services" inputElement="service" outputCollection="statuses" outputElement="=status" />
</bpmn:extensionElements>
</bpmn:multiInstanceLoopCharacteristics>
<bpmn:startEvent id="Event_1nezna4">
<bpmn:outgoing>Flow_058vll4</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:serviceTask id="Activity_0b9uo84" name="check the service status">
<bpmn:extensionElements>
<zeebe:taskDefinition type="MockShowNameCommand" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_058vll4</bpmn:incoming>
<bpmn:outgoing>Flow_06lzh3u</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_058vll4" sourceRef="Event_1nezna4" targetRef="Activity_0b9uo84" />
<bpmn:endEvent id="Event_0uyp356">
<bpmn:incoming>Flow_1xpzmsj</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_06lzh3u" sourceRef="Activity_0b9uo84" targetRef="Activity_1ezxom9" />
<bpmn:serviceTask id="Activity_1ezxom9" name="show All variables">
<bpmn:extensionElements>
<zeebe:taskDefinition type="DebugCommand" />
</bpmn:extensionElements>
<bpmn:incoming>Flow_06lzh3u</bpmn:incoming>
<bpmn:outgoing>Flow_1xpzmsj</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="Flow_1xpzmsj" sourceRef="Activity_1ezxom9" targetRef="Event_0uyp356" />
</bpmn:subProcess>
<bpmn:sequenceFlow id="Flow_17a0th4" sourceRef="Activity_1kujh3x" targetRef="Activity_0hl51m6" />
<bpmn:sequenceFlow id="Flow_0reym0t" sourceRef="Activity_0hl51m6" targetRef="Event_12hj9nh" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="mock-process">
<bpmndi:BPMNEdge id="Flow_0ulicn4_di" bpmnElement="Flow_0ulicn4">
<di:waypoint x="188" y="180" />
<di:waypoint x="240" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_17a0th4_di" bpmnElement="Flow_17a0th4">
<di:waypoint x="340" y="180" />
<di:waypoint x="400" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0reym0t_di" bpmnElement="Flow_0reym0t">
<di:waypoint x="1040" y="180" />
<di:waypoint x="1142" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Activity_1h65wqt_di" bpmnElement="Activity_1kujh3x">
<dc:Bounds x="240" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="152" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_12hj9nh_di" bpmnElement="Event_12hj9nh">
<dc:Bounds x="1142" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0hl51m6_di" bpmnElement="Activity_0hl51m6" isExpanded="true">
<dc:Bounds x="400" y="80" width="640" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_058vll4_di" bpmnElement="Flow_058vll4">
<di:waypoint x="476" y="180" />
<di:waypoint x="510" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_06lzh3u_di" bpmnElement="Flow_06lzh3u">
<di:waypoint x="610" y="180" />
<di:waypoint x="710" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1xpzmsj_di" bpmnElement="Flow_1xpzmsj">
<di:waypoint x="810" y="180" />
<di:waypoint x="952" y="180" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="Event_1nezna4_di" bpmnElement="Event_1nezna4">
<dc:Bounds x="440" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0uyp356_di" bpmnElement="Event_0uyp356">
<dc:Bounds x="952" y="162" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1k3pmb9_di" bpmnElement="Activity_0b9uo84">
<dc:Bounds x="510" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1ezxom9_di" bpmnElement="Activity_1ezxom9">
<dc:Bounds x="710" y="140" width="100" height="80" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
then i start the process the via
curl --location --request POST 'http://localhost:9999/workflows/start' \
--header 'Content-Type: application/json' \
--data-raw '{
"processDefinitionId":"mock-process",
"variables": {
"name": "shawn01",
"services": ["1a","2a","3a","4a"]
}
}'
the MockShowNameCommand will get current nano time and set to variable named currentTime
then i check my logs:
2020-05-27 14:21:46.029 INFO 66694 --- [ult-executor-74] io.zeebe.client.job.poller : Activated 1 jobs for worker default and job type MockCommand
2020-05-27 14:21:46.029 INFO 66694 --- [pool-2-thread-3] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job MockCommand
2020-05-27 14:21:46.030 INFO 66694 --- [pool-2-thread-3] c.a.a.r.middleware.zeebe.MockCommand : success run the job with name shawn01
2020-05-27 14:21:46.645 INFO 66694 --- [pool-2-thread-5] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job MockShowNameCommand
2020-05-27 14:21:46.645 INFO 66694 --- [pool-2-thread-3] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job MockShowNameCommand
2020-05-27 14:21:46.645 INFO 66694 --- [pool-2-thread-4] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job MockShowNameCommand
2020-05-27 14:21:46.645 INFO 66694 --- [ult-executor-74] io.zeebe.client.job.poller : Activated 4 jobs for worker default and job type MockShowNameCommand
2020-05-27 14:21:46.645 INFO 66694 --- [pool-2-thread-1] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job MockShowNameCommand
2020-05-27 14:21:46.646 INFO 66694 --- [pool-2-thread-3] c.a.a.r.m.zeebe.MockShowNameCommand : the service 2a with the currentTime 2624074564564357
2020-05-27 14:21:46.646 INFO 66694 --- [pool-2-thread-4] c.a.a.r.m.zeebe.MockShowNameCommand : the service 4a with the currentTime 2624074564568426
2020-05-27 14:21:46.646 INFO 66694 --- [pool-2-thread-1] c.a.a.r.m.zeebe.MockShowNameCommand : the service 3a with the currentTime 2624074564580008
2020-05-27 14:21:46.646 INFO 66694 --- [pool-2-thread-5] c.a.a.r.m.zeebe.MockShowNameCommand : the service 1a with the currentTime 2624074564564389
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-5] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job DebugCommand
2020-05-27 14:21:47.129 INFO 66694 --- [ult-executor-86] io.zeebe.client.job.poller : Activated 4 jobs for worker default and job type DebugCommand
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-4] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job DebugCommand
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-3] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job DebugCommand
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-2] c.a.a.r.m.zeebe.BusinessJobWrap : begin to process the job DebugCommand
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-4] c.a.a.r.m.zeebe.BusinessContext : the variables are {"status":true,"service":"4a","loopCounter":4,"statuses":[null,null,null,null],"name":"shawn01","time":"2020-05-27 14:21:46","services":["1a","2a","3a","4a"],"currentTime":2624074564564357}
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-2] c.a.a.r.m.zeebe.BusinessContext : the variables are {"status":true,"service":"2a","loopCounter":2,"statuses":[null,null,null,null],"name":"shawn01","time":"2020-05-27 14:21:46","services":["1a","2a","3a","4a"],"currentTime":2624074564564357}
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-4] c.a.a.r.middleware.zeebe.DebugCommand : debug the command
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-3] c.a.a.r.m.zeebe.BusinessContext : the variables are {"status":true,"service":"1a","loopCounter":1,"statuses":[null,null,null,null],"name":"shawn01","time":"2020-05-27 14:21:46","services":["1a","2a","3a","4a"],"currentTime":2624074564564357}
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-5] c.a.a.r.m.zeebe.BusinessContext : the variables are {"status":true,"service":"3a","loopCounter":3,"statuses":[null,null,null,null],"name":"shawn01","time":"2020-05-27 14:21:46","services":["1a","2a","3a","4a"],"currentTime":2624074564564357}
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-2] c.a.a.r.middleware.zeebe.DebugCommand : debug the command
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-3] c.a.a.r.middleware.zeebe.DebugCommand : debug the command
2020-05-27 14:21:47.129 INFO 66694 --- [pool-2-thread-5] c.a.a.r.middleware.zeebe.DebugCommand : debug the command
I real don’t understand why the variables in currentTime inshow all variables
job are all same. it should be different
And, how to reference the different currentTime in sub flow in this case?
thanks