Share via


ServiceBusReceiver.DeadLetterMessageAsync Method

Definition

Overloads

DeadLetterMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, CancellationToken)

Source:
ServiceBusReceiver.cs
Source:
ServiceBusReceiver.cs

Moves a message to the dead-letter subqueue.

public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary<string,object> propertiesToModify = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

propertiesToModify
IDictionary<String,Object>

The properties of the message to modify while moving to subqueue.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

Exceptions

  • The lock for the message has expired or the message has already been completed. This does not apply for session-enabled entities. The Reason will be set to MessageLockLost in this case.
  • The lock for the session has expired or the message has already been completed. This only applies for session-enabled entities. The Reason will be set to SessionLockLost in this case.

Remarks

In order to receive a message from the dead-letter queue or transfer dead-letter queue, set the SubQueue property to DeadLetter or TransferDeadLetter when calling CreateReceiver(String, ServiceBusReceiverOptions) or CreateReceiver(String, String, ServiceBusReceiverOptions). This operation can only be performed when ReceiveMode is set to PeekLock.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

DeadLetterMessageAsync(ServiceBusReceivedMessage, String, String, CancellationToken)

Source:
ServiceBusReceiver.cs
Source:
ServiceBusReceiver.cs

Moves a message to the dead-letter subqueue.

public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, string deadLetterReason, string deadLetterErrorDescription = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

deadLetterReason
String

The reason for dead-lettering the message.

deadLetterErrorDescription
String

The error description for dead-lettering the message.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

Exceptions

  • The lock for the message has expired or the message has already been completed. This does not apply for session-enabled entities. The Reason will be set to MessageLockLost in this case.
  • The lock for the session has expired or the message has already been completed. This only applies for session-enabled entities. The Reason will be set to SessionLockLost in this case.
  • The dead letter reason or dead letter error description exceeded the maximum length of 4096.

Remarks

In order to receive a message from the dead-letter queue or transfer dead-letter queue, set the SubQueue property to DeadLetter or TransferDeadLetter when calling CreateReceiver(String, ServiceBusReceiverOptions) or CreateReceiver(String, String, ServiceBusReceiverOptions). This operation can only be performed when ReceiveMode is set to PeekLock.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview

DeadLetterMessageAsync(ServiceBusReceivedMessage, IDictionary<String,Object>, String, String, CancellationToken)

Source:
ServiceBusReceiver.cs
Source:
ServiceBusReceiver.cs

Moves a message to the dead-letter subqueue.

public virtual System.Threading.Tasks.Task DeadLetterMessageAsync(Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.IDictionary<string,object> propertiesToModify, string deadLetterReason, string deadLetterErrorDescription = default, System.Threading.CancellationToken cancellationToken = default);

Parameters

propertiesToModify
IDictionary<String,Object>

The properties of the message to modify while moving to subqueue.

deadLetterReason
String

The reason for dead-lettering the message.

deadLetterErrorDescription
String

The error description for dead-lettering the message.

cancellationToken
CancellationToken

An optional CancellationToken instance to signal the request to cancel the operation.

Returns

Exceptions

  • The lock for the message has expired or the message has already been completed. This does not apply for session-enabled entities. The Reason will be set to MessageLockLost in this case.
  • The lock for the session has expired or the message has already been completed. This only applies for session-enabled entities. The Reason will be set to SessionLockLost in this case.
  • The dead letter reason or dead letter error exception was specified in both the parameter and the properties dictionary.
  • The dead letter reason or dead letter error description exceeded the maximum length of 4096.

Remarks

In order to receive a message from the dead-letter queue or transfer dead-letter queue, set the SubQueue property to DeadLetter or TransferDeadLetter when calling CreateReceiver(String, ServiceBusReceiverOptions) or CreateReceiver(String, String, ServiceBusReceiverOptions). This operation can only be performed when ReceiveMode is set to PeekLock. The dead letter reason and error description can only be specified either through the method parameters or hard coded using this properties.

Applies to

Azure SDK for .NET Preview and Azure SDK for .NET Latest
Product Versions
Azure SDK for .NET Latest, Preview