elsa-workflows / elsa-core

A .NET workflows library
https://v3.elsaworkflows.io/
MIT License
5.88k stars 1.06k forks source link

[BUG] Same input is send on every dispatched workflow - Bulk dispatch workflow activity #5235

Open MariusVuscanNx opened 3 weeks ago

MariusVuscanNx commented 3 weeks ago

Description

If we try to use the Bulk Dispatch Workflows activity with more than one item while having the mass-transit disabled, the same input will be sent to every dispatched workflow. This is reproducible every time and it always take the last item values.

Steps to Reproduce

  1. Attachments: workflow-definitions (7).zip

  2. Reproduction Rate: Indicate how often the bug occurs when following these steps (e.g., "every time", "intermittently: about 50% of the time"). Every time.

  3. Video/Screenshots: Sometimes, complex behaviors are better shown than described. If you think a video or screenshots would help clarify the issue, please include them. No video/screenshot.

  4. Additional Configuration: Mass transit has to be disabled.

Expected Behavior

Each item values should be sent to one workflow only. First item to first workflow, second item to second workflow,...

Actual Behavior

The last item values are sent to every workflow.

Screenshots

image image image

Environment

Log Output

No log.

Troubleshooting Attempts

The background provider is used, which relies on MediatR. The sending part seems ok, but in the DispatchedWorkflowHandler we received the same value every time, while we should have received different values (based on the Items array).

Additional Context

No additional info.

Related Issues

No related issue.

glime-ai[bot] commented 3 weeks ago

Based on the context provided, it seems that you are encountering an issue with the Bulk Dispatch Workflows activity in Elsa 3.1.1 where all dispatched workflows are receiving the same input, specifically the last item's values, when mass transit is disabled. This behavior is not expected as each dispatched workflow should receive its corresponding item values.

This could be a bug in the Bulk Dispatch Workflows activity implementation when used with the background provider that relies on MediatR. Since the DispatchedWorkflowHandler is receiving the same value every time, it suggests that there might be an issue with how the items are being iterated and dispatched within the handler.

To address this issue, you should verify the following:

  1. Ensure that the workflow definitions are correctly set up to handle individual items.
  2. Check the implementation of the Bulk Dispatch Workflows activity to ensure that it correctly iterates over the items and dispatches them to the workflows.
  3. Look for any recent updates or patches for Elsa 3.1.1 that might address this issue.
  4. Consider reaching out to the Elsa community or support channels with this detailed bug report to see if there is a known workaround or fix.

If you have access to the source code, you might also want to debug the DispatchedWorkflowHandler to see why it's not receiving different values as expected.

Unfortunately, without access to the actual source code or the ability to debug the application, I cannot provide a more specific solution. However, reporting this issue on the Elsa GitHub repository as a bug with all the details you've provided here would be a good next step.

This comment was generated by Glime.