如何使用 Azure 服务总线配置 EventBusServiceBus?

How configure EventBusServiceBus with Azure Service Bus?

我需要配置一个库EventBusServiceBus,但是搜索没有找到任何示例。拜托,我需要示例,如何使用 appSettings.json

配置与 EventBusServiceBus 的连接

这是“.NET 微服务:容器化 .NET 应用程序的体系结构”e-book,又名 eShopOnContainers,代码在 GitHub

EventBusServiceBus should receive an implementation of IServiceBusPersisterConnection. Which is implemented with DefaultServiceBusPersisterConnection, which subsequently depends on Azure Service Bus ServiceBusConnectionStringBuilder to be created and registered in the services. An example would be one of the services configurations such as Ordering service here.

appsettings.json 中,您必须定义以下设置:

  • AzureServiceBusEnabled 设置为 true
  • EventBusConnection 设置为 Azure 服务总线连接字符串

使用 eShopOnContainers 应用程序时,GIT 存储库中未正确实施服务总线。

您的连接字符串中缺少 entityPath 参数。您必须先在 Azure 服务总线中创建一个主题。在 Azure 服务总线中设置主题的 entityPath= 名称。在 Azure 服务总线中,还为此主题创建一个订阅。您需要在 appsettings.json 文件中进行配置。将 appsettings 文件中的 subscriptionClientName 的值设置为您刚刚创建的订阅的名称。