加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

c# – 如何使用.Net核心应用程序发送到EventHubs时优化吞吐量

发布时间:2020-12-15 22:48:59 所属栏目:百科 来源:网络整理
导读:如何创建多个使用多个底层TCP连接的EventHubClient,以允许从.net核心Web应用程序快速写入EventHub? 在EventHubs(https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-programming-guide)的编程指南中写道: It is important to note that additi
如何创建多个使用多个底层TCP连接的EventHubClient,以允许从.net核心Web应用程序快速写入EventHub?

在EventHubs(https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-programming-guide)的编程指南中写道:

It is important to note that additional EventHubClient objects created from a messaging factory instance reuse the same underlying TCP connection. Therefore,these objects have a client-side limit on throughput. The Create method reuses a single messaging factory. If you need very high throughput from a single sender,then you can create multiple message factories and one EventHubClient object from each messaging factory.

然后他们有一个代码示例:

var factory = MessagingFactory.CreateFromConnectionString("your_connection_string");
var client = factory.CreateEventHubClient("MyEventHub");

但是,我不知道.Net核心中是否存在MessagingFactory?从.Net核心可以做到这一点吗?我查看了Microsoft.Azure.ServiceBus但找不到任何内容.

解决方法

在测试之后,似乎使用EventHubClient创建多个客户端.CreateFromConnectionString将按预期打开与EventHubs的多个连接. (可以将连接视为Windows资源监视器中的单独TCP连接).

(当我仔细阅读文档时,我认为它仅适用于从MessaginFactory创建的EventHubClients,这在我第一次阅读时并不清楚.但我将此作为答案添加并让问题留在以防其他人阅读文档之类的我先做了)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读