@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(); } },
@Test public void shouldCompleteInstanceAfterInterruptingBoundaryEventTriggered() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToActivity("task") .boundaryEvent("timeout", b -> b.cancelActivity(true).timerWithDuration("PT0.1S")) .endEvent("end-2") .done()); testClient.createWorkflowInstance(PROCESS_ID); // when brokerRule.getClock().addTime(Duration.ofSeconds(1)); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.EVENT_ACTIVATED); }
@Test public void shouldCompleteInstanceAfterInterruptingBoundaryEventTriggered() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToActivity("task") .boundaryEvent("timeout", b -> b.cancelActivity(true).timerWithDuration("PT0.1S")) .endEvent("end-2") .done()); testClient.createWorkflowInstance(PROCESS_ID); // when brokerRule.getClock().addTime(Duration.ofSeconds(1)); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.ELEMENT_COMPLETED); }
.serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("timer1") .timerWithDuration("PT1S") .endEvent("timer1End") .moveToActivity("task") .boundaryEvent("timer2") .timerWithDuration("PT2S") .endEvent("timer2End") .done();
.serviceTask("task", b -> b.zeebeTaskType("type")) .boundaryEvent("timer1") .timerWithDuration("PT1S") .endEvent("timer1End") .moveToActivity("task") .boundaryEvent("timer2") .timerWithDuration("PT2S") .endEvent("timer2End") .done();
@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)); }
@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)); }
.boundaryEvent("timer") .cancelActivity(true) .timerWithDuration("PT1S") .endEvent("endTimer") .moveToActivity("sub")
.boundaryEvent("timer") .cancelActivity(true) .timerWithDuration("PT1S") .endEvent("endTimer") .moveToActivity("sub")