MessageSender Class

Definition

The MessageSender can be used to send messages to Queues or Topics.

public class MessageSender : Microsoft.Azure.ServiceBus.ClientEntity, Microsoft.Azure.ServiceBus.Core.IMessageSender
type MessageSender = class
    inherit ClientEntity
    interface IMessageSender
    interface ISenderClient
    interface IClientEntity
Public Class MessageSender
Inherits ClientEntity
Implements IMessageSender
Inheritance
System.Object
MessageSender
Implements

Examples

Create a new MessageSender to send to a Queue

IMessageSender messageSender = new MessageSender(
    namespaceConnectionString,
    queueName)

Send message

byte[] data = GetData();
await messageSender.SendAsync(data);

Remarks

This uses AMQP protocol to communicate with service.

Constructors

MessageSender(ServiceBusConnectionStringBuilder, RetryPolicy)

Creates a new AMQP MessageSender.

MessageSender(String, String, RetryPolicy)

Creates a new AMQP MessageSender.

Properties

ClientId

Gets the ID to identify this client. This can be used to correlate logs and exceptions.

(Inherited from ClientEntity)
IsClosedOrClosing

Returns true if the client is closed or closing.

(Inherited from ClientEntity)
OperationTimeout

Duration after which individual operations will timeout.

Path

Gets the entity path of the MessageSender.

RegisteredPlugins

Gets a list of currently registered plugins for this sender.

RetryPolicy

Gets the RetryPolicy defined on the client.

(Inherited from ClientEntity)

Methods

CancelScheduledMessageAsync(Int64)

Cancels a message that was scheduled.

CloseAsync()

Closes the Client. Closes the connections opened by it.

(Inherited from ClientEntity)
OnClosingAsync()

Closes the connection.

RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this sender.

ScheduleMessageAsync(Message, DateTimeOffset)

Schedules a message to appear on Service Bus at a later time.

SendAsync(IList<Message>)

Sends a list of messages to the entity as described by Path.

SendAsync(Message)

Sends a message to the entity as described by Path.

ThrowIfClosed()

Throw an OperationCanceledException if the object is Closing.

(Inherited from ClientEntity)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

Applies to