共用方式為


IMessageSender Interface

Definition

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

public interface IMessageSender : Microsoft.Azure.ServiceBus.Core.ISenderClient
type IMessageSender = interface
    interface ISenderClient
    interface IClientEntity
Public Interface IMessageSender
Implements ISenderClient
Derived
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);

Properties

ClientId

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

(Inherited from IClientEntity)
IsClosedOrClosing

Returns true if the client is closed or closing.

(Inherited from IClientEntity)
OperationTimeout

Duration after which individual operations will timeout.

(Inherited from IClientEntity)
OwnsConnection

Returns true if connection is owned and false if connection is shared.

(Inherited from IClientEntity)
Path

Gets the entity path.

(Inherited from IClientEntity)
RegisteredPlugins

Gets a list of currently registered plugins for this client.

(Inherited from IClientEntity)
ServiceBusConnection

Connection object to the service bus namespace.

(Inherited from IClientEntity)

Methods

CancelScheduledMessageAsync(Int64)

Cancels a message that was scheduled.

(Inherited from ISenderClient)
CloseAsync()

Closes the Client. Closes the connections opened by it.

(Inherited from IClientEntity)
RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this client.

(Inherited from IClientEntity)
ScheduleMessageAsync(Message, DateTimeOffset)

Schedules a message to appear on Service Bus.

(Inherited from ISenderClient)
SendAsync(IList<Message>)

Sends a list of messages to Service Bus. When called on partitioned entities, messages meant for different partitions cannot be batched together.

(Inherited from ISenderClient)
SendAsync(Message)

Sends a message to Service Bus.

(Inherited from ISenderClient)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

(Inherited from IClientEntity)

Applies to

See also