什么相当于最新SDK中的Microsoft.Azure.ServiceBus的ITopicClient,即Azure.Messaging.ServiceBus [英] What is the equivalent of ITopicClient of Microsoft.Azure.ServiceBus in the latest SDK i.e. Azure.Messaging.ServiceBus

查看:15
本文介绍了什么相当于最新SDK中的Microsoft.Azure.ServiceBus的ITopicClient,即Azure.Messaging.ServiceBus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的应用程序使用的是较旧的Service Bus SDK,即Microsoft.Azure.ServiceBus。现在我们想转到最新的SDK,即Azure.Messaging.ServiceBus.

但我在最新的SDK中找不到Microsoft.Azure.ServiceBus的ITopicClient,即Azure.Messaging.ServiceBus

基本上,我希望将此行代码从旧的SDK替换为最新的SDK。

 private async Task<bool> PublishMessageAsync( IList<IOurApplicationTopicClient> topicClients, 
                                          string topicName)
    {
       // some code 

       ITopicClient primaryTopicClient = topicClients.First(x => 
       x.ServiceBusType.Equals(ServiceBusType.Primary)
       && x.TopicName.Trim().Equals(topicName));

      //some code 
}

接口IOurApplicationTopicClient如下所示。

public interface IOurApplicationTopicClient: ITopicClient
{
    ServiceBusType ServiceBusType { get; set; }
    ServiceBusConnectionStringBuilder ServiceBusConnectionStringBuilder { get; set; }
}

此外,我不确定是否有用于更顺利迁移的任何适当文档。

推荐答案

ServiceBusSender类型是等效的;它能够发送到队列或主题,具体取决于创建它时传递的queueOrTopicName。发送方是使用CreateSender方法通过ServiceBusClient创建的。

同样的概念也适用于接收消息,其中ServiceBusReceiver负责读取队列和订阅,具体取决于它是如何创建的。接收器也是使用CreateReceiver方法通过ServiceBusClient创建的。

您可能会发现Migration Guide对从Microsoft.Azure.ServiceBus移动到Azure.Messaging.ServiceBus很有帮助。

这篇关于什么相当于最新SDK中的Microsoft.Azure.ServiceBus的ITopicClient,即Azure.Messaging.ServiceBus的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆