Udostępnij za pośrednictwem


TopicClient Class

Definition

TopicClient can be used for all basic interactions with a Service Bus topic.

public class TopicClient : Microsoft.Azure.ServiceBus.ClientEntity, Microsoft.Azure.ServiceBus.ITopicClient
type TopicClient = class
    inherit ClientEntity
    interface ITopicClient
    interface ISenderClient
    interface IClientEntity
Public Class TopicClient
Inherits ClientEntity
Implements ITopicClient
Inheritance
TopicClient
Implements

Examples

Create a new TopicClient

ITopicClient topicClient = new TopicClient(
    namespaceConnectionString,
    topicName,
    RetryExponential);

Send a message to the topic:

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

Remarks

It uses AMQP protocol for communicating with servicebus.

Constructors

TopicClient(ServiceBusConnection, String, RetryPolicy)

Creates a new instance of the Topic client on a given ServiceBusConnection

TopicClient(ServiceBusConnectionStringBuilder, RetryPolicy)

Instantiates a new TopicClient to perform operations on a topic.

TopicClient(String, String, ITokenProvider, TransportType, RetryPolicy)

Creates a new instance of the Topic client using the specified endpoint, entity path, and token provider.

TopicClient(String, String, RetryPolicy)

Instantiates a new TopicClient to perform operations on a topic.

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.

OwnsConnection

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

(Inherited from ClientEntity)
Path

Gets the name of the topic.

RegisteredPlugins

Gets a list of currently registered plugins for this TopicClient.

RetryPolicy

Gets the RetryPolicy defined on the client.

(Inherited from ClientEntity)
ServiceBusConnection

Connection object to the service bus namespace.

TopicName

Gets the name of the topic.

Methods

CancelScheduledMessageAsync(Int64)

Cancels a message that was scheduled.

CloseAsync()

Closes the Client. Closes the connections opened by it.

(Inherited from ClientEntity)
OnClosingAsync()
RegisterPlugin(ServiceBusPlugin)

Registers a ServiceBusPlugin to be used with this topic client.

ScheduleMessageAsync(Message, DateTimeOffset)

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

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.

SendAsync(Message)

Sends a message to Service Bus.

ThrowIfClosed()

Throw an OperationCanceledException if the object is Closing.

(Inherited from ClientEntity)
UnregisterPlugin(String)

Unregisters a ServiceBusPlugin.

Applies to