Delen via


ServiceBusSender.SendMessageAsync Method

Definition

Sends a message to the associated entity of Service Bus.

public virtual System.Threading.Tasks.Task SendMessageAsync (Azure.Messaging.ServiceBus.ServiceBusMessage message, System.Threading.CancellationToken cancellationToken = default);
abstract member SendMessageAsync : Azure.Messaging.ServiceBus.ServiceBusMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SendMessageAsync : Azure.Messaging.ServiceBus.ServiceBusMessage * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Overridable Function SendMessageAsync (message As ServiceBusMessage, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

message
ServiceBusMessage

The message to send.

cancellationToken
CancellationToken

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

Returns

A task to be resolved on when the operation has completed.

Exceptions

The message exceeds the maximum size allowed, as determined by the Service Bus service. The Reason will be set to MessageSizeExceeded in this case. For more information on service limits, see https://learn.microsoft.com/azure/service-bus-messaging/service-bus-quotas#messaging-quotas.

Occurs when the message has a member in its ApplicationProperties collection that is an unsupported type for serialization. See the ApplicationProperties remarks for details.

Applies to