Skip to content

Commit b8701e2

Browse files
committed
Learn Editor: Update service-bus-dead-letter-queues.md
1 parent 140d94e commit b8701e2

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

articles/service-bus-messaging/service-bus-dead-letter-queues.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ There's no automatic cleanup of the DLQ. Messages remain in the DLQ until you ex
2222

2323

2424
## DLQ message count
25-
It's not possible to obtain count of messages in the dead-letter queue at the topic level. That's because messages don't sit at the topic level unless Service Bus throws an internal error. Instead, when a sender sends a message to a topic, the message is forwarded to subscriptions for the topic within milliseconds and thus no longer resides at the topic level. So, you can see messages in the DLQ associated with the subscription for the topic. In the following example, **Service Bus Explorer** shows that there are 62 messages currently in the DLQ for the subscription "test1".
2625

26+
It's not possible to obtain count of messages in the dead-letter queue at the topic level. That's because messages don't sit at the topic level. Instead, when a sender sends a message to a topic, the message is forwarded to subscriptions for the topic within milliseconds and thus no longer resides at the topic level. So, you can see messages in the DLQ associated with the subscription for the topic. In the following example, **Service Bus Explorer** shows that there are 62 messages currently in the DLQ for the subscription "test1".
2727
![DLQ message count](./media/service-bus-dead-letter-queues/dead-letter-queue-message-count.png)
2828

2929
You can also get the count of DLQ messages by using Azure CLI command: [`az servicebus topic subscription show`](/cli/azure/servicebus/topic/subscription#az-servicebus-topic-subscription-show).
3030

3131
## Moving messages to the DLQ
32+
3233
There are several activities in Service Bus that cause messages to get pushed to the DLQ from within the messaging engine itself. An application can also explicitly move messages to the DLQ. The following two properties (dead-letter reason and dead-letter description) are added to dead-lettered messages. Applications can define their own codes for the dead-letter reason property, but the system sets the following values.
3334

3435
| Dead-letter reason | Dead-letter error description |
@@ -40,31 +41,37 @@ There are several activities in Service Bus that cause messages to get pushed to
4041
| MaxDeliveryCountExceeded | Message couldn't be consumed after maximum delivery attempts. See the [Maximum delivery count](#maximum-delivery-count) section for details. |
4142

4243
## Maximum delivery count
44+
4345
There is a limit on number of attempts to deliver messages for Service Bus queues and subscriptions. The default value is 10. Whenever a message has been delivered under a peek-lock, but has been either explicitly abandoned or the lock has expired, the delivery count on the message is incremented. When the delivery count exceeds the limit, the message is moved to the DLQ. The dead-letter reason for the message in DLQ is set to: MaxDeliveryCountExceeded. This behavior can't be disabled, but you can set the max delivery count to a large number.
4446

4547
## Time to live
48+
4649
When you enable dead-lettering on queues or subscriptions, all expiring messages are moved to the DLQ. The dead-letter reason code is set to: TTLExpiredException.
4750

4851
Deferred messages will not be purged and moved to the dead-letter queue after they expire. This behavior is by design.
4952

5053
## Errors while processing subscription rules
54+
5155
If you enable dead-lettering on filter evaluation exceptions, any errors that occur while a subscription's SQL filter rule executes are captured in the DLQ along with the offending message. Don't use this option in a production environment in which not all message types have subscribers.
5256

5357
## Application-level dead-lettering
58+
5459
In addition to the system-provided dead-lettering features, applications can use the DLQ to explicitly reject unacceptable messages. They can include messages that can't be properly processed because of any sort of system issue, messages that hold malformed payloads, or messages that fail authentication when some message-level security scheme is used.
5560

5661
This can be done by calling [QueueClient.DeadLetterAsync(Guid lockToken, string deadLetterReason, string deadLetterErrorDescription) method](/dotnet/api/microsoft.servicebus.messaging.queueclient.deadletterasync#microsoft-servicebus-messaging-queueclient-deadletterasync(system-guid-system-string-system-string)).
5762

5863
It is recommended to include the type of the exception in the DeadLetterReason and the StackTrace of the exception in the DeadLetterDescription as this makes it easier to troubleshoot the cause of the problem resulting in messages being dead-lettered. Be aware that this may result in some messages exceeding [the 256KB quota limit for the Standard Tier of Azure Service Bus](./service-bus-quotas.md), further indicating that the Premium Tier is what should be used for production environments.
5964

6065
## Dead-lettering in ForwardTo or SendVia scenarios
66+
6167
Messages will be sent to the transfer dead-letter queue under the following conditions:
6268

6369
- A message passes through more than four queues or topics that are [chained together](service-bus-auto-forwarding.md).
6470
- The destination queue or topic is disabled or deleted.
6571
- The destination queue or topic exceeds the maximum entity size.
6672

6773
## Path to the dead-letter queue
74+
6875
You can access the dead-letter queue by using the following syntax:
6976

7077
```
@@ -73,10 +80,22 @@ You can access the dead-letter queue by using the following syntax:
7380
```
7481

7582

83+
84+
85+
86+
87+
88+
89+
90+
91+
7692
## Sending dead-lettered messages to be reprocessed
93+
7794
As there can be valuable business data in messages that ended up in the dead-letter queue, it is desirable to have those messages be reprocessed when operators have finished dealing with the circumstances which caused the messages to be dead-lettered in the first place.
7895

7996
Tools like [Azure Service Bus Explorer](./explorer.md) enable manual moving of messages between queues and topics. If there are many messages in the dead-letter queue that need to be moved, [code like this](https://stackoverflow.com/a/68632602/151350) can help move them all at once. Operators will often prefer having a user interface so they can troubleshoot which message types have failed processing, from which source queues, and for what reasons, while still being able to resubmit batches of messages to be reprocessed. Tools like [ServicePulse with NServiceBus](https://docs.particular.net/servicepulse/intro-failed-messages) provide these capabilities.
8097

8198
## Next steps
99+
82100
See [Enable dead lettering for a queue or subscription](enable-dead-letter.md) to learn about different ways of configuring the **dead lettering on message expiration** setting.
101+

0 commit comments

Comments
 (0)