Retry And Delivery Descriptors¶
This page describes descriptors responsible for reliability and resiliency.
These descriptors control:
- subscriber retries;
- publisher retries;
- publisher acknowledgements.
RetryPolicyDescriptor¶
RetryPolicyDescriptor configures subscriber retry behavior.
Subscriber retry uses a RabbitMQ topology based on DLX, TTL and dead-letter routing.
Retry Condition¶
A message enters the retry topology only when the subscriber handler sets:
args.Acknowledged = false;
args.Requeue = true;
If Requeue is false, the retry topology is not used.
Runtime Topology¶
graph LR
MainQueue["Main Queue"]
Subscriber["Subscriber"]
DlxExchange["DLX Exchange<br/>queue_dlx"]
RetryQueue["Retry Queue<br/>queue_retry"]
RetryExchange["Retry Exchange<br/>queue_retry"]
MainQueue --> Subscriber
Subscriber -->|"Acknowledged = false<br/>Requeue = true"| DlxExchange
DlxExchange --> RetryQueue
RetryQueue -->|"x-message-ttl expires"| RetryExchange
RetryExchange --> MainQueue
Generated Retry Objects¶
The provider creates retry infrastructure using the main queue name and suffixes.
| Object | Suffix |
|---|---|
| DLX exchange | _dlx |
| Retry exchange | _retry |
| Retry queue | _retry |
Retry Queue Arguments¶
The retry queue uses these RabbitMQ arguments:
| Argument | Purpose |
|---|---|
x-message-ttl |
Defines the retry delay. |
x-dead-letter-exchange |
Sends expired messages to the retry exchange. |
x-queue-type |
Defines the retry queue type. |
x-queue-type is copied from the main queue when available.
Otherwise, the retry queue uses:
classic
Properties¶
| Property | Description |
|---|---|
Enabled |
Enables retry processing. |
MaxRetry |
Maximum retry attempts. |
Delayed |
Delay before the message is returned to the main queue. |
Durable |
Creates durable retry infrastructure. |
AutoDelete |
Controls retry object lifetime. |
Example¶
new RetryPolicyDescriptor
{
Enabled = true,
MaxRetry = 5,
Delayed = TimeSpan.FromSeconds(10),
Durable = true,
AutoDelete = false
};
PubRetryPolicyDescriptor¶
PubRetryPolicyDescriptor configures publisher retry behavior.
It is used when publish operations fail before the broker accepts the message.
Example¶
new PubRetryPolicyDescriptor
{
Enabled = true,
MaxRetry = 5,
Delayed = TimeSpan.FromSeconds(5)
};
DeliveryConfirmation¶
DeliveryConfirmation configures RabbitMQ publisher acknowledgements.
Purpose¶
Delivery confirmations allow a publisher to verify that RabbitMQ accepted a message.
sequenceDiagram
participant Publisher
participant RabbitMQ
Publisher->>RabbitMQ: Publish
RabbitMQ-->>Publisher: Ack / Nack
Properties¶
| Property | Description |
|---|---|
Enabled |
Enables publisher confirms. |
WaitFor |
Waits for confirmation before returning. |
Timeout |
Maximum wait duration. |
Example¶
new DeliveryConfirmation
{
Enabled = true,
WaitFor = true,
Timeout = TimeSpan.FromSeconds(30)
};
Retry vs Delivery Confirmation¶
| Feature | Purpose |
|---|---|
RetryPolicyDescriptor |
Retry subscriber message processing through DLX/TTL topology. |
PubRetryPolicyDescriptor |
Retry publishing operations. |
DeliveryConfirmation |
Verify broker acceptance. |
Recommendations¶
Use:
RetryPolicyDescriptorfor transient consumer failures;PubRetryPolicyDescriptorfor transient publishing failures;DeliveryConfirmationwhen message loss is unacceptable.