Auto attach incoming message dispatch properties to outgoing #7607
+57
−20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Quick spike to automatically propagate incoming message dispatch properties to the outgoing messages. If we did this for real we probably would have to differentiate the dispatch properties that always need to be copied to all messages vs the dispatch properties that should only be copied when the incoming message is copied in the recoverability and audit contexts.
This way headers do not need to be polluted with transport-specific key-value pairs, the headers are not extended for information that is natively stored on the underlying transport message and the information is also preserved in the outbox.
ServiceControl could easily store this information in the metadata and bring it back when materializing the transport operations for staging and retries. Then no native information is lost anymore because the dispatcher can always map it from the dispatch properties, and during transition we don't duplicate the information to headers that is natively available on the underlying SDK type. The information is only persisted separately for external persistences like outbox and SC.
This would allow storing native attributes and preserve them in SQS. It would allow using native concepts like the message group id. In ASB we could store things like subject, session ID etc. and never lose it again.
Complexity like https://github.com/Particular/NServiceBus.AmazonSQS/blob/master/src/NServiceBus.Transport.SQS/Sending/MessageDispatcher.cs#L429-L436 would be handled in Core