@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .serviceTask("task", b -> b.zeebeTaskType(taskType())) .boundaryEvent(elementId()) .timerWithDuration("PT0.01S") .endEvent() .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .serviceTask("task", b -> b.zeebeTaskType(taskType())) .boundaryEvent(elementId()) .timerWithDuration("PT0.01S") .endEvent() .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .serviceTask("task", b -> b.zeebeTaskType(taskType())) .boundaryEvent(elementId()) .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .endEvent() .done(); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .serviceTask("task", b -> b.zeebeTaskType(taskType())) .boundaryEvent(elementId()) .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .endEvent() .done(); }
@Test public void shouldUseScopeToExtractCorrelationKeys() { // given final String processId = "shouldHaveScopeKeyIfBoundaryEvent"; final BpmnModelInstance workflow = Bpmn.createExecutableProcess(processId) .startEvent() .serviceTask("task", c -> c.zeebeTaskType("type").zeebeInput("$.bar", "$.foo")) .boundaryEvent( "event", b -> b.message(m -> m.zeebeCorrelationKey("$.foo").name("message"))) .endEvent() .moveToActivity("task") .endEvent() .done(); testClient.deploy(workflow); // when testClient.createWorkflowInstance( processId, MsgPackUtil.asMsgPack(m -> m.put("foo", 1).put("bar", 2))); testClient.publishMessage("message", "1"); // then // if correlation key was extracted from the task, then foo in the task scope would be 2 and // no event occurred would be published assertThat(testClient.receiveElementInState("task", WorkflowInstanceIntent.EVENT_OCCURRED)) .isNotNull(); }
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("msg1") .cancelActivity(false) .message(m -> m.name("msg1").zeebeCorrelationKey("$.key"))
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("msg1") .cancelActivity(false) .message(m -> m.name("msg1").zeebeCorrelationKey("$.key"))
@Test public void shouldUseScopePayloadWhenApplyingOutputMappings() { // given final BpmnModelInstance workflow = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", b -> b.zeebeTaskType("type").zeebeInput("$.oof", "$.baz")) .boundaryEvent("timer") .cancelActivity(true) .timerWithDuration("PT1S") .zeebeOutputBehavior(ZeebeOutputBehavior.merge) .endEvent("endTimer") .moveToActivity("task") .endEvent() .done(); testClient.deploy(workflow); testClient.createWorkflowInstance(PROCESS_ID, "{\"foo\": 1, \"oof\": 2}"); // when testClient.receiveTimerRecord("timer", TimerIntent.CREATED); brokerRule.getClock().addTime(Duration.ofMinutes(1)); awaitProcessCompleted(); // then final Record<WorkflowInstanceRecordValue> boundaryTriggered = testClient.receiveElementInState("timer", WorkflowInstanceIntent.EVENT_TRIGGERED); assertThat(boundaryTriggered.getValue().getPayloadAsMap()) .contains(entry("foo", 1), entry("oof", 2)); }
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("timer1") .timerWithDuration("PT1S") .endEvent("timer1End")
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("timer1") .timerWithDuration("PT1S") .endEvent("timer1End")
@Test public void shouldUseScopePayloadWhenApplyingOutputMappings() { // given final BpmnModelInstance workflow = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", b -> b.zeebeTaskType("type").zeebeInput("$.oof", "$.baz")) .boundaryEvent("timer") .cancelActivity(true) .timerWithDuration("PT1S") .zeebeOutputBehavior(ZeebeOutputBehavior.merge) .endEvent("endTimer") .moveToActivity("task") .endEvent() .done(); testClient.deploy(workflow); testClient.createWorkflowInstance(PROCESS_ID, "{\"foo\": 1, \"oof\": 2}"); // when testClient.receiveTimerRecord("timer", TimerIntent.CREATED); brokerRule.getClock().addTime(Duration.ofMinutes(1)); awaitProcessCompleted(); // then final Record<WorkflowInstanceRecordValue> boundaryTriggered = testClient.receiveElementInState("timer", WorkflowInstanceIntent.ELEMENT_COMPLETED); assertThat(boundaryTriggered.getValue().getPayloadAsMap()) .contains(entry("foo", 1), entry("oof", 2)); }
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("event") .message(m -> m.name("message").zeebeCorrelationKey("$.key")) .zeebeOutput("$.foo", "$.bar")
.startEvent() .serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("event") .message(m -> m.name("message").zeebeCorrelationKey("$.key")) .zeebeOutput("$.foo", "$.bar")
.startEvent() .serviceTask("task", c -> c.zeebeTaskType("type")) .boundaryEvent( "event", b -> b.message(m -> m.zeebeCorrelationKey("$.orderId").name("message"))) .endEvent()