public static WorkflowInstanceSubscriptionRecordStream workflowInstanceSubscriptionRecords( final WorkflowInstanceSubscriptionIntent intent) { return workflowInstanceSubscriptionRecords().withIntent(intent); }
public static WorkflowInstanceSubscriptionRecordStream workflowInstanceSubscriptionRecords( final WorkflowInstanceSubscriptionIntent intent) { return workflowInstanceSubscriptionRecords().withIntent(intent); }
private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitSubscriptionsOpened( int subscriptionsCount) { return testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(subscriptionsCount) .asList(); } }
private List<Record<WorkflowInstanceSubscriptionRecordValue>> awaitSubscriptionsOpened( int subscriptionsCount) { return testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(subscriptionsCount) .asList(); } }
@Test public void shouldOpenWorkflowInstanceSubscription() { final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); final Record<WorkflowInstanceSubscriptionRecordValue> workflowInstanceSubscription = testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .getFirst(); assertThat(workflowInstanceSubscription.getMetadata().getValueType()) .isEqualTo(ValueType.WORKFLOW_INSTANCE_SUBSCRIPTION); assertThat(workflowInstanceSubscription.getMetadata().getRecordType()) .isEqualTo(RecordType.EVENT); assertWorkflowSubscription( workflowInstanceKey, catchEventEntered, workflowInstanceSubscription); }
@Test public void shouldOpenWorkflowInstanceSubscription() { final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); final Record<WorkflowInstanceSubscriptionRecordValue> workflowInstanceSubscription = testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .getFirst(); assertThat(workflowInstanceSubscription.getMetadata().getValueType()) .isEqualTo(ValueType.WORKFLOW_INSTANCE_SUBSCRIPTION); assertThat(workflowInstanceSubscription.getMetadata().getRecordType()) .isEqualTo(RecordType.EVENT); assertWorkflowSubscription( workflowInstanceKey, catchEventEntered, workflowInstanceSubscription); }
@Test public void shouldCorrelateMessageAndContinue() { // given testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); // when assertThat( testClient .receiveWorkflowInstanceSubscriptions() .withMessageName("order canceled") .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(1) .getFirst()) .isNotNull(); testClient.publishMessage("order canceled", "order-123"); // then assertThat( RecordingExporter.workflowInstanceRecords(continueState) .withElementId(continuedElementId) .exists()) .isTrue(); assertThat( RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN) .withElementId("to-end") .exists()) .isTrue(); } }
@Test public void shouldCorrelateWorkflowInstanceSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when final DirectBuffer messagePayload = asMsgPack("foo", "bar"); testClient.publishMessage("order canceled", "order-123", messagePayload); // then final Record<WorkflowInstanceSubscriptionRecordValue> subscription = testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.CORRELATED) .getFirst(); assertThat(subscription.getMetadata().getValueType()) .isEqualTo(ValueType.WORKFLOW_INSTANCE_SUBSCRIPTION); assertThat(subscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); assertWorkflowSubscription( workflowInstanceKey, "{\"foo\":\"bar\"}", catchEventEntered, subscription); }
@Test public void shouldCorrelateMessageAndContinue() { // given testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); // when assertThat( testClient .receiveWorkflowInstanceSubscriptions() .withMessageName("order canceled") .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(1) .getFirst()) .isNotNull(); testClient.publishMessage("order canceled", "order-123"); // then assertThat( RecordingExporter.workflowInstanceRecords(continueState) .withElementId(continuedElementId) .exists()) .isTrue(); assertThat( RecordingExporter.workflowInstanceRecords(WorkflowInstanceIntent.SEQUENCE_FLOW_TAKEN) .withElementId("to-end") .exists()) .isTrue(); } }
@Test public void shouldCorrelateWorkflowInstanceSubscription() { // given final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("orderId", "order-123")); final Record<WorkflowInstanceRecordValue> catchEventEntered = testClient.receiveElementInState("receive-message", enteredState); // when final DirectBuffer messagePayload = asMsgPack("foo", "bar"); testClient.publishMessage("order canceled", "order-123", messagePayload); // then final Record<WorkflowInstanceSubscriptionRecordValue> subscription = testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.CORRELATED) .getFirst(); assertThat(subscription.getMetadata().getValueType()) .isEqualTo(ValueType.WORKFLOW_INSTANCE_SUBSCRIPTION); assertThat(subscription.getMetadata().getRecordType()).isEqualTo(RecordType.EVENT); assertWorkflowSubscription( workflowInstanceKey, "{\"foo\":\"bar\"}", catchEventEntered, subscription); }
.receiveWorkflowInstanceSubscriptions() .withMessageName("message") .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .exists()) .isTrue();
.receiveWorkflowInstanceSubscriptions() .withMessageName("message") .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .exists()) .isTrue();
testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(1) .exists())
testClient .receiveWorkflowInstanceSubscriptions() .withIntent(WorkflowInstanceSubscriptionIntent.OPENED) .limit(1) .exists())