elsa-workflows / elsa-workflows/elsa-extensions

MassTransitWorkflowDispatcherFeature omits TransactionalWorkflowDispatcher — UseTransactionalOutbox silently no-ops

Closed
#203 0 comments 0 reactions 0 assignees View on GitHub
bug triaged
Dominant language
C#
Stars
49
Forks
48
Avg merge
21h 35m
Merged PRs (30d)
20

Description

## Problem

Enabling the MassTransit workflow dispatcher **removes** `TransactionalWorkflowDispatcher` from the `IWorkflowDispatcher` decorator stack. Hosts that set `WorkflowDispatcherOptions.UseTransactionalOutbox = true` therefore get a **silent no-op**: in-workflow `DispatchWorkflow` / `BulkDispatchWorkflows` publish to the bus immediately, without waiting for parent workflow-state commit — the exact crash window the transactional outbox was designed to close.

## Evidence

### Default core stack (elsa-core)

`WorkflowRuntimeFeature.WorkflowDispatcher`:

`ValidatingWorkflowDispatcher` → `TransactionalWorkflowDispatcher` → `BackgroundWorkflowDispatcher`

### MassTransit feature replaces the factory without Transactional

`src/modules/servicebus/Elsa.ServiceBus.MassTransit/Features/MassTransitWorkflowDispatcherFeature.cs`:

```csharp
f.WorkflowDispatcher = sp =>
{
var decoratedService = ActivatorUtilities.CreateInstance(sp);
return ActivatorUtilities.CreateInstance(sp, decoratedService);
};
```

Shell twin (`ShellFeatures/MassTransitWorkflowDispatcherFeature.cs`) likewise wraps only `Validating` → `MassTransit`.

### Docs promise (elsa-core wiki)

`doc/wiki/workflow-runtime.md` — transactional outbox applies to dispatch calls made from inside a running workflow when the option is enabled. That contract is broken for MassTransit-dispatcher hosts.

## Expected (subtractive)

Restore the same decorator shape as core:

`Validating` → `Transactional` → `MassTransit`

Do **not** invent a second outbox for MassTransit. Follow-through in elsa-core: outbox delivery must remain compatible with channel-aware / non-mediator dispatchers (see linked core issue on Channel + `WorkflowDispatchOutboxProcessor`).

## Not a duplicate of

- elsa-core #8150 — `PublishEvent` / `BackgroundStimulusDispatcher` bypass (stimulus path)
- elsa-core #8149 — stimulus dual/triple entry collapse
- elsa-core #5423 — MultiBus configuration

## Milestone

Unset — Elsa 3 Issue Triage / Crew Lead place. Soft: Backlog / Ready-after #8150. Do not auto-assign Engineer.

Contributor guide

Open the contributing guide

Research direction

Start with src/modules/servicebus/Elsa.ServiceBus.MassTransit/Features/MassTransitWorkflowDispatcherFeature.cs and ShellFeatures/MassTransitWorkflowDispatcherFeature.cs, then compare WorkflowRuntimeFeature.WorkflowDispatcher in elsa-core. Read doc/wiki/workflow-runtime.md and the linked core issue about channel-aware outbox delivery. Done means both MassTransit factories preserve the Validating → Transactional → MassTransit decorator shape without adding a second outbox.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.