@Test public void shouldCorrelateMessageWithZeroTTL() { // given testClient.deploy(SINGLE_MESSAGE_WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123")); assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED).exists()) .isTrue(); // when testClient.publishMessage("message", "order-123", asMsgPack("foo", "bar"), 0); // then final Record<WorkflowInstanceRecordValue> event = testClient.receiveElementInState("receive-message", WorkflowInstanceIntent.EVENT_TRIGGERED); assertThat(event.getValue().getWorkflowInstanceKey()).isEqualTo(workflowInstanceKey); }
@Test public void shouldCorrelateMessageWithZeroTTL() { // given testClient.deploy(SINGLE_MESSAGE_WORKFLOW); final long workflowInstanceKey = testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123")); assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED).exists()) .isTrue(); // when testClient.publishMessage("message", "order-123", asMsgPack("foo", "bar"), 0); // then final Record<WorkflowInstanceRecordValue> event = testClient.receiveElementInState( "receive-message", WorkflowInstanceIntent.ELEMENT_COMPLETED); assertThat(event.getValue().getWorkflowInstanceKey()).isEqualTo(workflowInstanceKey); }
@Test public void shouldCorrelateMessageIfEnteredBefore() { // given testClient.deploy(SINGLE_MESSAGE_WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123")); assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED).exists()) .isTrue(); // when testClient.publishMessage("message", "order-123", asMsgPack("foo", "bar")); // then final Record<WorkflowInstanceRecordValue> event = testClient.receiveElementInState("receive-message", WorkflowInstanceIntent.EVENT_TRIGGERED); assertWorkflowInstancePayload(event, "{'key':'order-123', 'foo':'bar'}"); }
@Test public void shouldCorrelateMessageIfEnteredBefore() { // given testClient.deploy(SINGLE_MESSAGE_WORKFLOW); testClient.createWorkflowInstance(PROCESS_ID, asMsgPack("key", "order-123")); assertThat( RecordingExporter.messageSubscriptionRecords(MessageSubscriptionIntent.OPENED).exists()) .isTrue(); // when testClient.publishMessage("message", "order-123", asMsgPack("foo", "bar")); // then final Record<WorkflowInstanceRecordValue> event = testClient.receiveElementInState( "receive-message", WorkflowInstanceIntent.ELEMENT_COMPLETED); assertWorkflowInstancePayload(event, "{'key':'order-123', 'foo':'bar'}"); }