-
Notifications
You must be signed in to change notification settings - Fork 299
Docs for Azure Service Bus transport 6.3.0 #8191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
93d05a4
First draft
andreasohlund c40734b
Snippets
andreasohlund a681769
Add note about v6.3
andreasohlund 2e14302
Use level 2 heading
andreasohlund 0f14f14
Apply suggestions from code review
andreasohlund 9d6fadf
Update transports/azure-service-bus/configuration_dead-lettering_asbs…
DavidBoike cdbfb84
Make H2toH4 into H2toH3
DavidBoike d5896ef
Bump alpha
danielmarbach 01ca7e1
MaxDeliveryCount and ThrowOnMissingTopicWhenPublishing
danielmarbach 4226543
Fix region
andreasohlund 6cb8b2a
Use stable 6.3.0
andreasohlund 688b6ae
Fix documentation
danielmarbach 399ff4b
Wildcard
danielmarbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using NServiceBus; | ||
| using NServiceBus.Transport.AzureServiceBus; | ||
|
|
||
| class DeadLettering | ||
| { | ||
| void MoveErrorsToDeadLetterQueue(EndpointConfiguration endpointConfiguration) | ||
| { | ||
| #region dlq-all-errors | ||
|
|
||
| endpointConfiguration.Recoverability() | ||
| .MoveErrorsToAzureServiceBusDeadLetterQueue(); | ||
|
|
||
| #endregion | ||
| } | ||
|
|
||
| void ExplicitDlq(EndpointConfiguration endpointConfiguration) | ||
| { | ||
| #region explicit-dlq | ||
|
|
||
| endpointConfiguration.Recoverability() | ||
| .CustomPolicy((config, errorContext) => | ||
| { | ||
| if (errorContext.Exception is PoisonMessageException) | ||
| { | ||
| return RecoverabilityAction.DeadLetter(); | ||
| } | ||
|
|
||
| return DefaultRecoverabilityPolicy.Invoke(config, errorContext); | ||
| }); | ||
|
|
||
| #endregion | ||
| } | ||
|
|
||
| void ExplicitDlqFullControl(EndpointConfiguration endpointConfiguration) | ||
| { | ||
| #region explicit-dlq-full-control | ||
|
|
||
| endpointConfiguration.Recoverability() | ||
| .CustomPolicy((config, errorContext) => | ||
| { | ||
| if (errorContext.Exception is MyBusinessException ex) | ||
| { | ||
| return RecoverabilityAction.DeadLetter( | ||
| deadLetterReason: "Business rule validation failed", | ||
| deadLetterErrorDescription: ex.Message, | ||
| propertiesToModify: new Dictionary<string, object> | ||
| { | ||
| ["FailureCategory"] = "Validation" | ||
| }); | ||
| } | ||
|
|
||
| return DefaultRecoverabilityPolicy.Invoke(config, errorContext); | ||
|
|
||
| }); | ||
| #endregion | ||
| } | ||
|
|
||
| class PoisonMessageException : Exception | ||
| { | ||
| } | ||
|
|
||
| class MyBusinessException : Exception | ||
| { | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
transports/azure-service-bus/configuration_dead-lettering_asbs_[6,).partial.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| ## Dead lettering | ||
|
|
||
| > [!NOTE] | ||
| > Support for dead lettering is available in Version 6.3.0 and higher. | ||
|
|
||
| Azure Service Bus provides a native dead-letter queue (DLQ) for each queue and subscription. NServiceBus can integrate with this mechanism, allowing failed messages to be dead-lettered natively and forwarded to the central NServiceBus error queue. | ||
|
|
||
| For background information on Azure Service Bus dead-letter queues, see [Overview of Service Bus dead-letter queues](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-dead-letter-queues). | ||
|
|
||
| ### Forward dead-lettered messages to the error queue | ||
|
|
||
| When queues are created by the transport, native dead-lettered messages can be auto-forwarded to the configured error queue: | ||
|
|
||
| snippet: enable-dlq-auto-forwarding | ||
|
|
||
| This setting is opt-in and affects only queues created by the transport. See the [`asb-transport` provisioning commands](/transports/azure-service-bus/operational-scripting.md) for more details on scripting options. | ||
|
|
||
| ### Route all failed messages to the native DLQ | ||
|
|
||
| To route failed messages to the native Azure Service Bus dead-letter queue instead of the NServiceBus error queue, enable: | ||
|
|
||
| snippet: dlq-all-errors | ||
|
|
||
| ### Request dead lettering from recoverability | ||
|
|
||
| Use a [custom recoverability policy](/nservicebus/recoverability/custom-recoverability-policy.md) to explicitly request dead lettering for selected failures. | ||
|
|
||
| Dead-letter with standard NServiceBus fault metadata: | ||
|
|
||
| snippet: explicit-dlq | ||
|
|
||
| Dead-letter with custom reason, description, and modified application properties: | ||
|
|
||
| > [!NOTE] | ||
| > Using this option does note automatically add the NServiceBus faults metadata to the application properties. | ||
|
|
||
| snippet: explicit-dlq-full-control | ||
|
|
||
| ### Fault header mapping | ||
|
|
||
| When processing dead-lettered messages, the transport maps native dead-letter properties to [error forwarding headers](/nservicebus/messaging/headers.md#error-forwarding-headers) when those headers are not already present: | ||
|
|
||
| - `DeadLetterSource` -> `NServiceBus.FailedQ` | ||
| - `DeadLetterReason` -> `NServiceBus.ExceptionInfo.Message` | ||
| - `DeadLetterErrorDescription` -> `NServiceBus.ExceptionInfo.StackTrace` | ||
|
|
||
| This mapping helps tools such as ServiceControl and ServicePulse present failure information consistently. | ||
|
|
||
| ### Monitoring and operations | ||
|
|
||
| [ServicePulse failed message monitoring](/servicepulse/intro-failed-messages.md) tracks messages in the NServiceBus error queue. If endpoint failures are kept in native Azure Service Bus dead-letter queues without forwarding, those failures require Azure-native operational tooling. | ||
|
|
||
| Enable DLQ forwarding as described above when you want to centralized native dead lettering and failed-message handling. | ||
|
|
||
| ### Caveats | ||
|
|
||
| - `TransportTransactionMode.None` uses receive-and-delete semantics, so dead-lettering actions cannot be performed in that mode. See [transport transactions](/transports/transactions.md#transaction-modes-unreliable-transactions-disabled). | ||
| - The transport truncates dead-letter reason and description to 1024 characters to reduce oversized message risk. Review Azure limits in [Service Bus quotas](https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-quotas). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.