Skip to content

Receive properties are lost on delayed retries - #7900

Merged
lailabougria merged 3 commits into
masterfrom
fix-delayed-retries-propagation
Aug 5, 2026
Merged

Receive properties are lost on delayed retries#7900
lailabougria merged 3 commits into
masterfrom
fix-delayed-retries-propagation

Conversation

@lailabougria

@lailabougria lailabougria commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Symptoms

When a message that carries native transport metadata via ReceiveProperties fails processing and is retried using delayed retries, the native receive properties are stripped. The metadata is present on the initial delivery but missing from the message once it is redelivered after the retry delay.

For example, a transport that relies on native metadata such as a message group id or deduplication id would see those values on the first delivery and then lose them on every subsequent delayed-retry delivery.

Who's affected

Only transport authors who adopt the new ReceiveProperties API (introduced in NServiceBus 10.2.0 via #7662) to carry native message metadata through the pipeline are affected.

End users of the Particular-supported transports are not affected, as no Particular transport currently uses the ReceiveProperties feature.

Root cause

Receive properties are propagated onto outgoing dispatch operations by RoutingToDispatchConnector, but only when it can locate an IncomingMessage with a matching message ID in the current context extensions.

During a delayed retry, the recoverability pipeline creates an OutgoingMessage with the original message ID and dispatches it back to the input queue through the routing/dispatch pipeline. The RecoverabilityContext already held the ReceiveProperties as a direct property, but it never published an IncomingMessage into its context extensions. Consequently, when RoutingToDispatchConnector looked one up during the delayed-retry dispatch, the lookup failed, the receive properties resolved to empty, and the redelivered message shipped without its native metadata.

The fix publishes the IncomingMessage (carrying the receive properties) into the recoverability context extensions, so the metadata flows through the routing context into the dispatch stage and survives the delayed retry (#7900).

@danielmarbach danielmarbach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be backported

@andreasohlund

Copy link
Copy Markdown
Member

Did we break this in #7741 or has this always been broken?

@danielmarbach

Copy link
Copy Markdown
Contributor

@andreasohlund it was always broken

@lailabougria
lailabougria merged commit 83ee9be into master Aug 5, 2026
4 checks passed
@lailabougria
lailabougria deleted the fix-delayed-retries-propagation branch August 5, 2026 11:35
@danielmarbach danielmarbach added Bug and removed Bug labels Aug 5, 2026
@danielmarbach danielmarbach changed the title Preserve the native properties on delayed retries Receive properties are lost on delayed retries Aug 5, 2026
danielmarbach added a commit that referenced this pull request Aug 5, 2026
* Preserve the native properties on delayed retries

* Slightly better assertions hopefully

* Align handler attribute usage with other tests since we forgot to change that

---------

Co-authored-by: Laila Bougria <laila.bougria@particular.net>
Co-authored-by: Daniel Marbach <danielmarbach@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants