@Override public IntermediateCatchEventBuilder builder() { return new IntermediateCatchEventBuilder((BpmnModelInstance) modelInstance, this); } }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway(elementId()) .intermediateCatchEvent() .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT0.01S") .done(); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .endEvent() .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT1H") .endEvent() .done(); } },
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .done(); } },
@Test public void shouldCompleteInstanceAfterEventBasedGateway() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .eventBasedGateway("gateway") .intermediateCatchEvent( "catch-1", e -> e.message(m -> m.name("msg-1").zeebeCorrelationKey("$.key"))) .endEvent("end-2") .moveToNode("gateway") .intermediateCatchEvent( "catch-2", e -> e.message(m -> m.name("msg-2").zeebeCorrelationKey("$.key"))) .endEvent("end-3") .done()); testClient.createWorkflowInstance(PROCESS_ID, "{'key':'123'}"); // when testClient.completeJobOfType("task"); testClient.publishMessage("msg-1", "123"); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.EVENT_ACTIVATED); }
.parallelGateway() .intermediateCatchEvent("message1") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .moveToLastGateway() .intermediateCatchEvent("message2") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .done());
@Test public void shouldRejectDeploymentIfUsedInvalidMessage() throws IOException { // given final BpmnModelInstance process = Bpmn.createExecutableProcess().startEvent().intermediateCatchEvent("invalidmessage").done(); // when final ExecuteCommandResponse resp = apiRule.partitionClient().deployWithResponse(process); // then assertThat(resp.getRecordType()).isEqualTo(RecordType.COMMAND_REJECTION); }
@Test public void shouldCompleteInstanceAfterEventBasedGateway() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .eventBasedGateway("gateway") .intermediateCatchEvent( "catch-1", e -> e.message(m -> m.name("msg-1").zeebeCorrelationKey("$.key"))) .endEvent("end-2") .moveToNode("gateway") .intermediateCatchEvent( "catch-2", e -> e.message(m -> m.name("msg-2").zeebeCorrelationKey("$.key"))) .endEvent("end-3") .done()); testClient.createWorkflowInstance(PROCESS_ID, "{'key':'123'}"); // when testClient.completeJobOfType("task"); testClient.publishMessage("msg-1", "123"); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.ELEMENT_COMPLETED); }
.parallelGateway() .intermediateCatchEvent("message1") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .moveToLastGateway() .intermediateCatchEvent("message2") .message(m -> m.name("ping").zeebeCorrelationKey("$.key")) .done());
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .done(); } },
@Test public void shouldRejectDeploymentIfUsedInvalidMessage() throws IOException { // given final BpmnModelInstance process = Bpmn.createExecutableProcess().startEvent().intermediateCatchEvent("invalidmessage").done(); // when final ExecuteCommandResponse resp = apiRule.partitionClient().deployWithResponse(process); // then assertThat(resp.getRecordType()).isEqualTo(RecordType.COMMAND_REJECTION); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway() .intermediateCatchEvent(elementId()) .timerWithDuration("PT0.01S") .endEvent() .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT1H") .endEvent() .done(); } },
@Test public void shouldCompleteInstanceAfterMessageIntermediateCatchEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .intermediateCatchEvent( "catch", e -> e.message(m -> m.name("msg").zeebeCorrelationKey("$.key"))) .endEvent("end-2") .done()); testClient.createWorkflowInstance(PROCESS_ID, "{'key':'123'}"); // when testClient.completeJobOfType("task"); testClient.publishMessage("msg", "123"); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.EVENT_ACTIVATED); }
@Override BpmnModelInstance modelInstance() { return Bpmn.createExecutableProcess(processId()) .startEvent() .eventBasedGateway(elementId()) .intermediateCatchEvent() .message(b -> b.name(messageName()).zeebeCorrelationKey("$.id")) .moveToLastGateway() .intermediateCatchEvent() .timerWithDuration("PT0.01S") .done(); }
@Test public void shouldCancelIntermediateCatchEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .intermediateCatchEvent("catch-event") .message(b -> b.name("msg").zeebeCorrelationKey("$.id")) .done()); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("id", "123")); testClient.receiveElementInState("catch-event", WorkflowInstanceIntent.EVENT_ACTIVATED); final ExecuteCommandResponse response = cancelWorkflowInstance(workflowInstanceKey); // then assertThat(response.getIntent()).isEqualTo(WorkflowInstanceIntent.ELEMENT_TERMINATING); final Record<WorkflowInstanceRecordValue> terminatedEvent = testClient.receiveElementInState(PROCESS_ID, WorkflowInstanceIntent.ELEMENT_TERMINATED); assertWorkflowInstanceRecord(workflowInstanceKey, PROCESS_ID, terminatedEvent); }
@Override public IntermediateCatchEventBuilder builder() { return new IntermediateCatchEventBuilder((BpmnModelInstance) modelInstance, this); } }
@Test public void shouldTriggerTimerWithZeroDuration() { // given final BpmnModelInstance workflow = Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .intermediateCatchEvent("timer", c -> c.timerWithDuration("PT0S")) .endEvent() .done(); testClient.deploy(workflow); testClient.createWorkflowInstance(PROCESS_ID); // then assertThat(RecordingExporter.timerRecords(TimerIntent.TRIGGERED).exists()).isTrue(); }
@Test public void shouldCompleteInstanceAfterMessageIntermediateCatchEvent() { // given testClient.deploy( Bpmn.createExecutableProcess(PROCESS_ID) .startEvent() .parallelGateway() .serviceTask("task", t -> t.zeebeTaskType("task")) .endEvent("end-1") .moveToLastGateway() .intermediateCatchEvent( "catch", e -> e.message(m -> m.name("msg").zeebeCorrelationKey("$.key"))) .endEvent("end-2") .done()); testClient.createWorkflowInstance(PROCESS_ID, "{'key':'123'}"); // when testClient.completeJobOfType("task"); testClient.publishMessage("msg", "123"); // then assertThatWorkflowInstanceCompletedAfter("end-2", WorkflowInstanceIntent.ELEMENT_COMPLETED); }