https://github.com/zeebe-io/zeebe-docker-compose
将整个zeebe-docker-compose项目clone
启动operate
切换到operate目录
docker-compose up
会启动broker,operate,以及exporter(elasticsearch)在内的结点,
删除持久化卷
如果想清除掉原先的数据,可以删除持久化卷
在启动docker-compose up指令的目录的地方使用如下指令停止容器
docker-compose down
使用如下指令
docker volume rm operate_zeebe_data
docker volume rm operate_zeebe_elasticsearch_data
Http worker
启动一个zeebe-http-worker结点来执行type为http的任务,将如下的内容保存成docker-compose.yml
version: "2"
networks:
operate_zeebe_network:
external: true
services:
zeebe-http-worker:
container_name: zeebe-http-worker
image: camunda/zeebe-http-worker:latest
environment:
- zeebe.client.broker.contactPoint=zeebe:26500
external_links:
- zeebe
networks:
- operate_zeebe_network
使用
docker-compose up
指令进行zeebe-http-worker的启动。
新建一个bpmn文件demoProcess.bpmn,内容为
<?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_1x0j1oc" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Zeebe Modeler" exporterVersion="0.10.0">
<bpmn:process id="httpproc" isExecutable="true">
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_078e0r6</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:sequenceFlow id="Flow_078e0r6" sourceRef="StartEvent_1" targetRef="Activity_0hf8mr9" />
<bpmn:serviceTask id="Activity_0hf8mr9" name="http task">
<bpmn:extensionElements>
<zeebe:taskDefinition type="http" />
<zeebe:taskHeaders>
<zeebe:header key="url" value="https://www.baidu.com/" />
<zeebe:header key="method" value="post" />
</zeebe:taskHeaders>
</bpmn:extensionElements>
<bpmn:incoming>Flow_078e0r6</bpmn:incoming>
<bpmn:outgoing>Flow_15973q5</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:endEvent id="Event_0wk4iau">
<bpmn:incoming>Flow_15973q5</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_15973q5" sourceRef="Activity_0hf8mr9" targetRef="Event_0wk4iau" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="httpproc">
<bpmndi:BPMNEdge id="Flow_15973q5_di" bpmnElement="Flow_15973q5">
<di:waypoint x="410" y="117" />
<di:waypoint x="522" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_078e0r6_di" bpmnElement="Flow_078e0r6">
<di:waypoint x="178" y="117" />
<di:waypoint x="310" y="117" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="142" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0y49w2n_di" bpmnElement="Activity_0hf8mr9">
<dc:Bounds x="310" y="77" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0wk4iau_di" bpmnElement="Event_0wk4iau">
<dc:Bounds x="522" y="99" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
部署工作流
/zbctl.darwin --insecure deploy demoProcess.bpmn
创建工作流实例
/zbctl.darwin --insecure create instance httpproc
登录到http:localhost:8080,用户名和密码都为demo
屏幕快照 2020-11-17 下午9.51.09.pnghttp的url配置的是百度的地址,报
java.lang.RuntimeException: Failed to deserialize response body from JSON:
需要响应的内容是json格式
访问本地服务
将工作流中的http task的http配置成localhost或者127.0.0.1都会报 java.util.concurrent.ExecutionException: java.net.ConnectException: Connection refused at
另外不要开代理,不然可能还是无法访问。
url要设成路由器分配的ip就可以访问(这个应该与容器网络有关)
屏幕快照 2020-11-18 下午2.11.54.png
网友评论