Move UseTransport to extension type similar to how persistence, serializer works #7451
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.
Generally it is not recommended to use features within the transport seam, but Azure Service Bus currently requires it to propagate earlier the transport transaction in cases when the native outgoing message customizers are used on top of
SendOptions,PublishOptionsorReplyOptions.We have attempted some spiking around introducing a more explicit way to bring context into the dispatched transport operations, but it would require some breaking changes to the properties of the transport operations, which may also affect outbox transport operations.
This non-breaking change moves the
UseTransportmethod from the endpoint configuration to an extension method similar to howUsePersistenceandUseSerializeralready work. By having it in an extension method, downstream transports can add more specific APIs when needed, which allows them to gain access to the endpoint configuration when the transport is used in non-raw modes. An example with Azure Service BusThis approach makes it apparent when the features will be active and when they won't be, and access to features within the transport is slightly more involved (since it should only ever be done when needed).