elsa-workflows / elsa-workflows/elsa-core

Elsa cannot consume/receive MassTransit messages that are published out of order to what the Workflow expects

Open
#4,091 2 comments 0 reactions 0 assignees View on GitHub
activity bug elsa 2 elsa 3 triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

We have ran into an issue with "Asychronous", or out-of-workflow-order, MassTransit messages and how the workflow handles those messages.

The goal:
Elsa workflow will consume messages that may come in, in a different order than the Workflow expects (as the workflow is written).
Elsa can Consume (ReceiveMassTransitMessage) in any order that messages are published to the queue.

e.g.:

Workflow is able to consume all of these messages, regardless of when they were written to the queue (in our case by a separate application).

Outside process Publishes messages in this order:
Message "One"
Message Three"
Message "Two"

Workflow that is set up as follows, is able to leave "Three" in the RabbitMQ queue until "Two" is received. Then, once "Two" is consumed, "Three" will immediately be consumed after.
Consume "One" message
Consume "Two" message
Consume "Three" message

I have set up an example project that will show what I am trying to accomplish better than I can describe (below)

Run the "ElsaMTTestng" project with "Project" launch profile so it will display console and swagger.
https://github.com/T-Vandehey/ElsaMTTesting

Note: ASPNET Controllers & Swagger are set up for sending the HTTP Post requests below.

Steps to reproduce:
1. Start app and have a Guid ready to be used
2. Send POST with guid to "One" endpoint
- Pass: The workflow receives "One" message
3. Send POST with guid to "Three" endpoint
Pass - Message is not received by Elsa immediately
4. Send POST with guid to "Two" endpoint
- Pass: The workflow received "Two" message
- Fail: The workflow does not receive "Three" message that should be sitting in RabbitMQ queue
- Note: The "Three" message has already been consumed in the background and discarded by Elsa(?) (confirmed via RabbitMQ UI)
5. Send POST with guid to "Three" endpoint again
- Workflow receives this second "Three" message, instead of the first "Three" message

Contributor guide

Open the contributing guide

Research direction

Start by running the ElsaMTTesting example with the Project launch profile, then use the ASP.NET controller endpoints to publish One, Three, and Two while watching the RabbitMQ queue. Trace why the first Three message is consumed and discarded, and verify that the queued Three message is delivered after Two without sending it again.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, rabbitmq
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.