[英]Azure Event Hub - multiple event types in same Event Hub
I have set up Azure Event Hub . 我已经设置了Azure Event Hub 。 There are 2 publishers :
有2个发布者 :
Publisher 1 (with Send Policy) 发布者1(带发送政策)
Publisher 2 (with Send Policy) 发布者2(带发送政策)
Publisher 1 will send Event 1 and Publisher 2 will send Event 2. Both Event 1 & Event 2 are different format. 发布者1将发送事件1,发布者2将发送事件2.事件1和事件2都是不同的格式。
Question 1 : This would mean we have different messages in EH - what are the tradeoff with this approach? 问题1 :这意味着我们在EH中有不同的信息 - 这种方法的权衡是什么? Should I instead create 2 EH (one for Publisher 1 and another for Publisher 2)?
我应该创建2个EH(一个用于Publisher 1,另一个用于Publisher 2)? What is the best practice and design philosophy?
什么是最佳实践和设计理念?
If I go with above approach, I would have to set up a Consumer with Listen Policy to look for these events and parse/transform these events and de-serialize these. 如果我采用上述方法,我将不得不设置一个带有Listen策略的Consumer来查找这些事件并解析/转换这些事件并对这些事件进行反序列化。
Question 2 : Would I need 2 Consumers (Consumer 1 and Consumer 2) to read messages meant for them ? 问题2 :我是否需要2个消费者(消费者1和消费者2)阅读针对他们的消息? (Consumer 1 will read only Event 1 and Consumer 2 will read only Event 2)?
(消费者1只读事件1而消费者2只读事件2)?
Scenario 1: One Event Hub for multiple event types 场景1:多事件类型的一个事件中心
In this scenario you have multiple options when it comes to sending and processing the messages: 在这种情况下,您在发送和处理消息时有多个选项:
Scenario 2: An Event Hub per event types 场景2:每个事件类型的事件中心
This one is easy, just create 2 event hubs and 2 consuming processes. 这个很简单,只需创建2个事件中心和2个消耗过程。 But you'll have to manage 2 event hubs and given the abilities of an Event Hub it might be overkill.
但是你必须管理2个事件中心,并且考虑到事件中心的能力,它可能有点过分。
My advice 我的建议
It depends on the amount of data, but based on my experience I would go to send all messages the one event hub and have one process reading the message and perform an action based on the message type using some c# code. 这取决于数据量,但根据我的经验,我会将所有消息发送到一个事件中心,并让一个进程读取消息并使用一些c#代码基于消息类型执行操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.