你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

TopicClient 类

定义

TopicClient 可用于与服务总线主题的所有基本交互。

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
继承
TopicClient
实现

示例

创建新的 TopicClient

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

向主题发送消息:

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

注解

它使用 AMQP 协议与 servicebus 通信。

构造函数

TopicClient(ServiceBusConnection, String, RetryPolicy)

在给定的 上创建 Topic 客户端的新实例 ServiceBusConnection

TopicClient(ServiceBusConnectionStringBuilder, RetryPolicy)

实例化新的 TopicClient 以对主题执行操作。

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

使用指定的终结点、实体路径和令牌提供程序创建 Topic 客户端的新实例。

TopicClient(String, String, RetryPolicy)

实例化新的 TopicClient 以对主题执行操作。

属性

ClientId

获取用于标识此客户端的 ID。 这可用于关联日志和异常。

(继承自 ClientEntity)
IsClosedOrClosing

如果客户端已关闭或关闭,则返回 true。

(继承自 ClientEntity)
OperationTimeout

持续时间过后,单个操作将超时。

OwnsConnection

如果拥有连接,则返回 true;如果共享连接,则返回 false。

(继承自 ClientEntity)
Path

获取主题的名称。

RegisteredPlugins

获取此 TopicClient 当前注册的插件的列表。

RetryPolicy

获取 RetryPolicy 在客户端上定义的 。

(继承自 ClientEntity)
ServiceBusConnection

服务总线命名空间的连接对象。

TopicName

获取主题的名称。

方法

CancelScheduledMessageAsync(Int64)

取消已计划的消息。

CloseAsync()

关闭客户端。 关闭它打开的连接。

(继承自 ClientEntity)
OnClosingAsync()

TopicClient 可用于与服务总线主题的所有基本交互。

RegisterPlugin(ServiceBusPlugin)

ServiceBusPlugin注册要与本主题客户端一起使用的 。

ScheduleMessageAsync(Message, DateTimeOffset)

计划稍后在服务总线上显示一条消息。

SendAsync(IList<Message>)

将消息列表发送到服务总线。 当对分区实体调用时,用于不同分区的消息不能一起批处理。

SendAsync(Message)

向服务总线发送消息。

ThrowIfClosed()

如果对象为“正在关闭”,则引发 OperationCanceledException。

(继承自 ClientEntity)
UnregisterPlugin(String)

取消注册 ServiceBusPlugin

适用于