-
-
Save berndruecker/d2561e4c1ef3cb22ba0d6715be407612 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zbctl --insecure deploy sample.bpmn | |
zbctl --insecure create instance Sample | |
--> | |
Start {"key":2251799813685324,"type":"wait","customHeaders":{},"workflowInstanceKey":2251799813685312,"bpmnProcessId":"Process_1t8j55q","workflowDefinitionVersion":1,"workflowKey":2251799813685249,"elementId":"Task_18mob0q","elementInstanceKey":2251799813685321,"worker":"myWorker","retries":3,"deadline":1586510625000,"variables":"{}","variablesAsMap":{}} | |
Start {"key":2251799813685326,"type":"wait","customHeaders":{},"workflowInstanceKey":2251799813685312,"bpmnProcessId":"Process_1t8j55q","workflowDefinitionVersion":1,"workflowKey":2251799813685249,"elementId":"Task_1g8xu4t","elementInstanceKey":2251799813685323,"worker":"myWorker","retries":3,"deadline":1586510625000,"variables":"{}","variablesAsMap":{}} | |
Start {"key":2251799813685325,"type":"wait","customHeaders":{},"workflowInstanceKey":2251799813685312,"bpmnProcessId":"Process_1t8j55q","workflowDefinitionVersion":1,"workflowKey":2251799813685249,"elementId":"Task_179f8rb","elementInstanceKey":2251799813685322,"worker":"myWorker","retries":3,"deadline":1586510625000,"variables":"{}","variablesAsMap":{}} | |
...finished | |
...finished | |
...finished | |
Start {"key":2251799813685338,"type":"wait","customHeaders":{},"workflowInstanceKey":2251799813685312,"bpmnProcessId":"Process_1t8j55q","workflowDefinitionVersion":1,"workflowKey":2251799813685249,"elementId":"Task_0pzb5of","elementInstanceKey":2251799813685337,"worker":"myWorker","retries":3,"deadline":1586510627163,"variables":"{}","variablesAsMap":{}} | |
...finished |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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_0gq4rn5" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Zeebe Modeler" exporterVersion="0.8.0"> | |
<bpmn:process id="Sample" isExecutable="true"> | |
<bpmn:startEvent id="StartEvent_1"> | |
<bpmn:outgoing>SequenceFlow_0dla8dg</bpmn:outgoing> | |
</bpmn:startEvent> | |
<bpmn:sequenceFlow id="SequenceFlow_0dla8dg" sourceRef="StartEvent_1" targetRef="ExclusiveGateway_0w6qk09" /> | |
<bpmn:parallelGateway id="ExclusiveGateway_0w6qk09"> | |
<bpmn:incoming>SequenceFlow_0dla8dg</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_0ozybf2</bpmn:outgoing> | |
<bpmn:outgoing>SequenceFlow_1k6gm44</bpmn:outgoing> | |
<bpmn:outgoing>SequenceFlow_11e8v0d</bpmn:outgoing> | |
</bpmn:parallelGateway> | |
<bpmn:sequenceFlow id="SequenceFlow_0ozybf2" sourceRef="ExclusiveGateway_0w6qk09" targetRef="Task_1g8xu4t" /> | |
<bpmn:sequenceFlow id="SequenceFlow_1k6gm44" sourceRef="ExclusiveGateway_0w6qk09" targetRef="Task_179f8rb" /> | |
<bpmn:sequenceFlow id="SequenceFlow_11e8v0d" sourceRef="ExclusiveGateway_0w6qk09" targetRef="Task_18mob0q" /> | |
<bpmn:endEvent id="EndEvent_1r0t4lj"> | |
<bpmn:incoming>SequenceFlow_1mlsbrl</bpmn:incoming> | |
</bpmn:endEvent> | |
<bpmn:sequenceFlow id="SequenceFlow_1mlsbrl" sourceRef="Task_1g8xu4t" targetRef="EndEvent_1r0t4lj" /> | |
<bpmn:sequenceFlow id="SequenceFlow_1gh6w00" sourceRef="Task_179f8rb" targetRef="ExclusiveGateway_1xrocoh" /> | |
<bpmn:parallelGateway id="ExclusiveGateway_1xrocoh"> | |
<bpmn:incoming>SequenceFlow_1gh6w00</bpmn:incoming> | |
<bpmn:incoming>SequenceFlow_1e4zq39</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_0e0blcs</bpmn:outgoing> | |
</bpmn:parallelGateway> | |
<bpmn:sequenceFlow id="SequenceFlow_1e4zq39" sourceRef="Task_18mob0q" targetRef="ExclusiveGateway_1xrocoh" /> | |
<bpmn:sequenceFlow id="SequenceFlow_0e0blcs" sourceRef="ExclusiveGateway_1xrocoh" targetRef="Task_0pzb5of" /> | |
<bpmn:endEvent id="EndEvent_0wev4p1"> | |
<bpmn:incoming>SequenceFlow_1l3w97l</bpmn:incoming> | |
</bpmn:endEvent> | |
<bpmn:sequenceFlow id="SequenceFlow_1l3w97l" sourceRef="Task_0pzb5of" targetRef="EndEvent_0wev4p1" /> | |
<bpmn:serviceTask id="Task_1g8xu4t" name="Task1"> | |
<bpmn:extensionElements> | |
<zeebe:taskDefinition type="wait" /> | |
</bpmn:extensionElements> | |
<bpmn:incoming>SequenceFlow_0ozybf2</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_1mlsbrl</bpmn:outgoing> | |
</bpmn:serviceTask> | |
<bpmn:serviceTask id="Task_179f8rb" name="Task2"> | |
<bpmn:extensionElements> | |
<zeebe:taskDefinition type="wait" /> | |
</bpmn:extensionElements> | |
<bpmn:incoming>SequenceFlow_1k6gm44</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_1gh6w00</bpmn:outgoing> | |
</bpmn:serviceTask> | |
<bpmn:serviceTask id="Task_18mob0q" name="Task3"> | |
<bpmn:extensionElements> | |
<zeebe:taskDefinition type="wait" /> | |
</bpmn:extensionElements> | |
<bpmn:incoming>SequenceFlow_11e8v0d</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_1e4zq39</bpmn:outgoing> | |
</bpmn:serviceTask> | |
<bpmn:serviceTask id="Task_0pzb5of" name="Task4"> | |
<bpmn:extensionElements> | |
<zeebe:taskDefinition type="wait" /> | |
</bpmn:extensionElements> | |
<bpmn:incoming>SequenceFlow_0e0blcs</bpmn:incoming> | |
<bpmn:outgoing>SequenceFlow_1l3w97l</bpmn:outgoing> | |
</bpmn:serviceTask> | |
</bpmn:process> | |
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> | |
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1t8j55q"> | |
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> | |
<dc:Bounds x="179" y="159" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_0dla8dg_di" bpmnElement="SequenceFlow_0dla8dg"> | |
<di:waypoint x="215" y="177" /> | |
<di:waypoint x="265" y="177" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="ParallelGateway_1t17toa_di" bpmnElement="ExclusiveGateway_0w6qk09"> | |
<dc:Bounds x="265" y="152" width="50" height="50" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_0ozybf2_di" bpmnElement="SequenceFlow_0ozybf2"> | |
<di:waypoint x="290" y="152" /> | |
<di:waypoint x="290" y="80" /> | |
<di:waypoint x="370" y="80" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="SequenceFlow_1k6gm44_di" bpmnElement="SequenceFlow_1k6gm44"> | |
<di:waypoint x="315" y="177" /> | |
<di:waypoint x="370" y="177" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="SequenceFlow_11e8v0d_di" bpmnElement="SequenceFlow_11e8v0d"> | |
<di:waypoint x="290" y="202" /> | |
<di:waypoint x="290" y="280" /> | |
<di:waypoint x="370" y="280" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="EndEvent_1r0t4lj_di" bpmnElement="EndEvent_1r0t4lj"> | |
<dc:Bounds x="532" y="62" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_1mlsbrl_di" bpmnElement="SequenceFlow_1mlsbrl"> | |
<di:waypoint x="470" y="80" /> | |
<di:waypoint x="532" y="80" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="SequenceFlow_1gh6w00_di" bpmnElement="SequenceFlow_1gh6w00"> | |
<di:waypoint x="470" y="177" /> | |
<di:waypoint x="525" y="177" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="ParallelGateway_1xvs22x_di" bpmnElement="ExclusiveGateway_1xrocoh"> | |
<dc:Bounds x="525" y="152" width="50" height="50" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_1e4zq39_di" bpmnElement="SequenceFlow_1e4zq39"> | |
<di:waypoint x="470" y="280" /> | |
<di:waypoint x="550" y="280" /> | |
<di:waypoint x="550" y="202" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="SequenceFlow_0e0blcs_di" bpmnElement="SequenceFlow_0e0blcs"> | |
<di:waypoint x="575" y="177" /> | |
<di:waypoint x="630" y="177" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="EndEvent_0wev4p1_di" bpmnElement="EndEvent_0wev4p1"> | |
<dc:Bounds x="792" y="159" width="36" height="36" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNEdge id="SequenceFlow_1l3w97l_di" bpmnElement="SequenceFlow_1l3w97l"> | |
<di:waypoint x="730" y="177" /> | |
<di:waypoint x="792" y="177" /> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNShape id="ServiceTask_161u16m_di" bpmnElement="Task_1g8xu4t"> | |
<dc:Bounds x="370" y="40" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="ServiceTask_0i6btf9_di" bpmnElement="Task_179f8rb"> | |
<dc:Bounds x="370" y="137" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="ServiceTask_1hidcci_di" bpmnElement="Task_18mob0q"> | |
<dc:Bounds x="370" y="240" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="ServiceTask_0byri8l_di" bpmnElement="Task_0pzb5of"> | |
<dc:Bounds x="630" y="137" width="100" height="80" /> | |
</bpmndi:BPMNShape> | |
</bpmndi:BPMNPlane> | |
</bpmndi:BPMNDiagram> | |
</bpmn:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SysoutWorker { | |
// make sure you have more than one worker thread to be truly parallel | |
private static final int WORKER_THREADS = 5; | |
public static void main(String[] args) { | |
ZeebeClient zeebeClient = zeebe(); | |
JobWorker worker = zeebeClient.newWorker() | |
.jobType("wait") | |
.handler(new JobHandler() { | |
@Override | |
public void handle(JobClient client, ActivatedJob job) throws Exception { | |
System.err.println("Start " + job); | |
Thread.sleep(2000); | |
System.err.println(" ...finished"); | |
ZeebeFuture<Void> future = client.newCompleteCommand(job.getKey()).send(); | |
future.join(); | |
} | |
}) | |
.name("myWorker") | |
.open(); | |
} | |
public static ZeebeClient zeebe() { | |
// Cloud stuff if you want to use Camunda Cloud | |
final String clusterUUID = "50e7a806-f8e5-4b5c-8fbf-7735eccce141"; | |
final String baseUrl = "zeebe.camunda.io"; | |
final String clientId = "kJyxCah0djYpMUVTxd1M53L35PjIGC4z"; | |
final String clientSecret = "LRFz3B_cj5n3hPjkPYq3QkoMSw3BiRe34geRDYXWAxxT3PEP7j33B_ZWan0EogZh"; | |
final String authUrl = "https://login.cloud.camunda.io/oauth/token"; | |
final String broker = clusterUUID + "." + baseUrl + ":443"; | |
final OAuthCredentialsProviderBuilder c = new OAuthCredentialsProviderBuilder(); | |
final OAuthCredentialsProvider cred = c.audience(clusterUUID + "." + baseUrl).clientId(clientId) | |
.clientSecret(clientSecret).authorizationServerUrl(authUrl).build(); | |
// or I am using a local broker here | |
final ZeebeClientBuilder clientBuilder = ZeebeClient.newClientBuilder() // | |
// .brokerContactPoint(broker).credentialsProvider(cred) // | |
.usePlaintext() | |
.numJobWorkerExecutionThreads(WORKER_THREADS); | |
return clientBuilder.build(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment