Share via


ServiceBusMessageActions.DeadLetterMessageAsync Method

Definition

Overloads

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

Moves a message to the dead-letter subqueue.

DeadLetterMessageAsync(ServiceBusReceivedMessage, String, String, CancellationToken)

Moves a message to the dead-letter subqueue.

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

Moves a message to the dead-letter subqueue.

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

Source:
ServiceBusMessageActions.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);
abstract member DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Collections.Generic.IDictionary<string, obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Collections.Generic.IDictionary<string, obj> * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function DeadLetterMessageAsync (message As ServiceBusReceivedMessage, Optional propertiesToModify As IDictionary(Of String, Object) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

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

DeadLetterMessageAsync(ServiceBusReceivedMessage, String, String, CancellationToken)

Source:
ServiceBusMessageActions.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);
abstract member DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function DeadLetterMessageAsync (message As ServiceBusReceivedMessage, deadLetterReason As String, Optional deadLetterErrorDescription As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

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

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

Source:
ServiceBusMessageActions.cs

Moves a message to the dead-letter subqueue.

public virtual System.Threading.Tasks.Task DeadLetterMessageAsync (Azure.Messaging.ServiceBus.ServiceBusReceivedMessage message, System.Collections.Generic.Dictionary<string,object> propertiesToModify, string deadLetterReason, string deadLetterErrorDescription = default, System.Threading.CancellationToken cancellationToken = default);
abstract member DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Collections.Generic.Dictionary<string, obj> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.DeadLetterMessageAsync : Azure.Messaging.ServiceBus.ServiceBusReceivedMessage * System.Collections.Generic.Dictionary<string, obj> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function DeadLetterMessageAsync (message As ServiceBusReceivedMessage, propertiesToModify As Dictionary(Of String, Object), deadLetterReason As String, Optional deadLetterErrorDescription As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

propertiesToModify
Dictionary<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