BPMN XML:

<?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:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:zeebe="http://camunda.org/schema/zeebe/1.0" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_04x34d3" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Zeebe Modeler" exporterVersion="0.9.1">
  <bpmn:process id="Process_0nh7u74" isExecutable="true">
    <bpmn:startEvent id="StartEvent_1" name="Inicio">
      <bpmn:outgoing>Flow_16y96fn</bpmn:outgoing>
    </bpmn:startEvent>
    <bpmn:intermediateCatchEvent id="Event_1dsb4ha" name="Espera Kafka">
      <bpmn:incoming>Flow_14q1xuv</bpmn:incoming>
      <bpmn:outgoing>Flow_0qsq477</bpmn:outgoing>
      <bpmn:messageEventDefinition id="MessageEventDefinition_0udvotg" messageRef="Message_116lh4l" />
    </bpmn:intermediateCatchEvent>
    <bpmn:sequenceFlow id="Flow_16y96fn" sourceRef="StartEvent_1" targetRef="Activity_0o754b8" />
    <bpmn:sequenceFlow id="Flow_14q1xuv" sourceRef="Activity_0o754b8" targetRef="Event_1dsb4ha" />
    <bpmn:exclusiveGateway id="Gateway_1nqrff7">
      <bpmn:incoming>Flow_0qsq477</bpmn:incoming>
      <bpmn:outgoing>Flow_1uvfife</bpmn:outgoing>
      <bpmn:outgoing>Flow_0tnh174</bpmn:outgoing>
    </bpmn:exclusiveGateway>
    <bpmn:sequenceFlow id="Flow_0qsq477" sourceRef="Event_1dsb4ha" targetRef="Gateway_1nqrff7" />
    <bpmn:sequenceFlow id="Flow_1uvfife" name="No" sourceRef="Gateway_1nqrff7" targetRef="Activity_0t3nk15">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=resp=false</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:sequenceFlow id="Flow_1tkfu0a" sourceRef="Activity_0t3nk15" targetRef="Activity_0o754b8" />
    <bpmn:endEvent id="Event_0vybsz4" name="Fim">
      <bpmn:incoming>Flow_0tnh174</bpmn:incoming>
    </bpmn:endEvent>
    <bpmn:sequenceFlow id="Flow_0tnh174" name="Yes" sourceRef="Gateway_1nqrff7" targetRef="Event_0vybsz4">
      <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">=resp=true</bpmn:conditionExpression>
    </bpmn:sequenceFlow>
    <bpmn:serviceTask id="Activity_0o754b8" name="chamada Inicial">
      <bpmn:extensionElements>
        <zeebe:taskHeaders>
          <zeebe:header key="kafka-topic" value="zbChamadaInicial" />
        </zeebe:taskHeaders>
        <zeebe:taskDefinition type="chamadaInicial" retries="1" />
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_16y96fn</bpmn:incoming>
      <bpmn:incoming>Flow_1tkfu0a</bpmn:incoming>
      <bpmn:outgoing>Flow_14q1xuv</bpmn:outgoing>
    </bpmn:serviceTask>
    <bpmn:serviceTask id="Activity_0t3nk15" name="Deu errado">
      <bpmn:extensionElements>
        <zeebe:taskDefinition type="deuErrado" retries="1" />
      </bpmn:extensionElements>
      <bpmn:incoming>Flow_1uvfife</bpmn:incoming>
      <bpmn:outgoing>Flow_1tkfu0a</bpmn:outgoing>
    </bpmn:serviceTask>
  </bpmn:process>
  <bpmn:message id="Message_116lh4l" name="callResp">
    <bpmn:extensionElements>
      <zeebe:subscription correlationKey="=pocId" />
    </bpmn:extensionElements>
  </bpmn:message>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_0nh7u74">
      <bpmndi:BPMNEdge id="Flow_0tnh174_di" bpmnElement="Flow_0tnh174">
        <di:waypoint x="675" y="117" />
        <di:waypoint x="782" y="117" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="720" y="99" width="18" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1tkfu0a_di" bpmnElement="Flow_1tkfu0a">
        <di:waypoint x="460" y="270" />
        <di:waypoint x="350" y="270" />
        <di:waypoint x="350" y="157" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_1uvfife_di" bpmnElement="Flow_1uvfife">
        <di:waypoint x="650" y="142" />
        <di:waypoint x="650" y="270" />
        <di:waypoint x="560" y="270" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="658" y="203" width="15" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_0qsq477_di" bpmnElement="Flow_0qsq477">
        <di:waypoint x="528" y="117" />
        <di:waypoint x="625" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_14q1xuv_di" bpmnElement="Flow_14q1xuv">
        <di:waypoint x="400" y="117" />
        <di:waypoint x="492" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNEdge id="Flow_16y96fn_di" bpmnElement="Flow_16y96fn">
        <di:waypoint x="215" y="117" />
        <di:waypoint x="300" y="117" />
      </bpmndi:BPMNEdge>
      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
        <dc:Bounds x="179" y="99" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="185" y="142" width="26" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_1qz9ubj_di" bpmnElement="Event_1dsb4ha">
        <dc:Bounds x="492" y="99" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="477" y="142" width="67" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Gateway_1nqrff7_di" bpmnElement="Gateway_1nqrff7" isMarkerVisible="true">
        <dc:Bounds x="625" y="92" width="50" height="50" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Event_0vybsz4_di" bpmnElement="Event_0vybsz4">
        <dc:Bounds x="782" y="99" width="36" height="36" />
        <bpmndi:BPMNLabel>
          <dc:Bounds x="791" y="142" width="19" height="14" />
        </bpmndi:BPMNLabel>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_171sc5y_di" bpmnElement="Activity_0o754b8">
        <dc:Bounds x="300" y="77" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="Activity_0y5n7l3_di" bpmnElement="Activity_0t3nk15">
        <dc:Bounds x="460" y="230" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

SINK JSON:

{
    "name": "poc-sink",
    "config": {
      "connector.class": "io.zeebe.kafka.connect.ZeebeSinkConnector",
      "tasks.max": "1",
      "key.converter": "org.apache.kafka.connect.storage.StringConverter",
      "value.converter": "org.apache.kafka.connect.storage.StringConverter",
      "topics": "pocConfirm",
  
      "errors.tolerance": "all",
      "errors.deadletterqueue.topic.name":"deadletterqueue",
      "errors.deadletterqueue.topic.replication.factor": 1,
  
      "zeebe.client.broker.contactPoint": "cluster-1-zeebe-gateway.zeebe.svc.cluster.local:26500",
      "zeebe.client.requestTimeout": "10000",
      "zeebe.client.security.plaintext": true,
  
      "message.path.messageName": "$.eventType",
      "message.path.correlationKey": "$.pocId",
      "message.path.variables": "$.['pocId','resp']"
    }
  }

SOURCE JSON:

{
    "name": "poc-source",
    "config": {
        "zeebe.client.job.worker": "kafka-connector",
        "zeebe.client.job.pollinterval": "2000",
        "name": "poc-source",
        "connector.class": "io.zeebe.kafka.connect.ZeebeSourceConnector",
        "tasks.max": "1",
        "key.converter": "org.apache.kafka.connect.storage.StringConverter",
        "value.converter": "org.apache.kafka.connect.storage.StringConverter",
        "zeebe.client.broker.contactPoint": "cluster-1-zeebe-gateway.zeebe.svc.cluster.local:26500",
        "zeebe.client.requestTimeout": "10000",
        "zeebe.client.security.plaintext": "true",
        "zeebe.client.worker.name": "kafka-connector",
        "zeebe.client.worker.maxJobsActive": "1000",
        "zeebe.client.job.timeout": "5000",
        "job.types": "chamadaInicial",
        "job.header.topics": "kafka-topic"
    }
}

Simular worker:

zbctl create worker --handler cat --maxJobsActive 1 deuErrado --insecure

Criar instancia:

zbctl create instance --variables "{\"pocId\": 64}" Process_0nh7u74 --insecure

Mensagem para Kafka (via producer):

{"eventType":"callResp", "pocId":65,"resp":false}

O QUE NÃO ALTERAR:

No sink connector:

No source connector:

Na mensagem:


🌱 Back to Garden