MassTransit 多总线或单总线
MassTransit Multi Bus or One Bus
我阅读了 this 文章,了解如何在 MassTransit 中配置额外的总线实例。
我的情况:我有两个个人 NuGet 包(例如 Notification 和 Audit Log 包),每个包都有消息契约和消费者,然后 MassTransit
将自己的总线注册到每个人中。
这些包已经在MyApi Application
中使用过,其中也有Message Contracts和Consumers。和 MassTransit 以及另一辆在 MyApi 应用程序中注册的公交车。
现在我不确定是使用多总线还是单总线。如果我为他们所有人使用一辆公共汽车,那么我想我必须将包裹的组装传递给 MassTransit 注册以注册他们的消费者。对吗?
services.AddMassTransit(x =>
{
x.AddConsumer<NotificationConsumers>();
x.AddConsumer<AuditLogConsumers>();
x.AddConsumer<MyApiAppConsumers>();
// etc ...
});
MultiBus 的主要用例是一个应用程序连接到两个不同的代理实例,甚至使用不同的传输。对于所有其他情况,您实际上并不需要 MultiBus。
它在您引用的文章开头提到:
However, with broader use of cloud-based platforms comes a greater variety of messaging transports, not to mention HTTP as a transfer protocol. As application sophistication increases, connecting to multiple message transports and/or brokers is becoming more common. Therefore, rather than force developers to create their own solutions, MassTransit has the ability to configure additional bus instances within specific dependency injection containers.
我阅读了 this 文章,了解如何在 MassTransit 中配置额外的总线实例。
我的情况:我有两个个人 NuGet 包(例如 Notification 和 Audit Log 包),每个包都有消息契约和消费者,然后 MassTransit
将自己的总线注册到每个人中。
这些包已经在MyApi Application
中使用过,其中也有Message Contracts和Consumers。和 MassTransit 以及另一辆在 MyApi 应用程序中注册的公交车。
现在我不确定是使用多总线还是单总线。如果我为他们所有人使用一辆公共汽车,那么我想我必须将包裹的组装传递给 MassTransit 注册以注册他们的消费者。对吗?
services.AddMassTransit(x =>
{
x.AddConsumer<NotificationConsumers>();
x.AddConsumer<AuditLogConsumers>();
x.AddConsumer<MyApiAppConsumers>();
// etc ...
});
MultiBus 的主要用例是一个应用程序连接到两个不同的代理实例,甚至使用不同的传输。对于所有其他情况,您实际上并不需要 MultiBus。
它在您引用的文章开头提到:
However, with broader use of cloud-based platforms comes a greater variety of messaging transports, not to mention HTTP as a transfer protocol. As application sophistication increases, connecting to multiple message transports and/or brokers is becoming more common. Therefore, rather than force developers to create their own solutions, MassTransit has the ability to configure additional bus instances within specific dependency injection containers.