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

如何创建多个使用多个底层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,这在我第一次阅读时并不清楚.但我将此作为答案添加并让问题留在以防其他人阅读文档之类的我先做了)

相关文章

目录简介使用JS互操作使用ClipLazor库创建项目使用方法简单测...
目录简介快速入门安装 NuGet 包实体类User数据库类DbFactory...
本文实现一个简单的配置类,原理比较简单,适用于一些小型项...
C#中Description特性主要用于枚举和属性,方法比较简单,记录...
[TOC] # 原理简介 本文参考[C#/WPF/WinForm/程序实现软件开机...
目录简介获取 HTML 文档解析 HTML 文档测试补充:使用 CSS 选...