我正在使用事件中心,想知道哪一种是更好的消费事件方法 事件处理器主机或直接接收器。如果其中之一更好,那么为什么。
您还可以帮助我任何 java 代码示例 github 或 java Azure SDK 来编写事件使用者。
使用分区和消费者组是更好的方法吗?
最佳答案
Does using partitions and consumer groups is better approach
无论您如何消费事件,您始终拥有至少一个消费组和至少 2 个分区。它不是可选的。
Also Can you help me any java code sample github or java Azure SDK to write event consumer.
I am using Event Hub, wanted to know which one is better approach to consume events Event Processor Host or Direct Receivers. if one of it is better then why.
根据the docs :
For most production scenarios, we recommend that you use the event processor client for reading and processing events. The processor client is intended to provide a robust experience for processing events across all partitions of an event hub in a performant and fault tolerant manner while providing a means to checkpoint its progress. Event processor clients can work cooperatively within the context of a consumer group for a given event hub. Clients will automatically manage distribution and balancing of work as instances become available or unavailable for the group.
关于直接消费者:
This method is not recommended for production use; the EventProcessorClient should be used for reading events from all partitions in a production scenario, as it offers a much more robust experience with higher throughput.
使用直接消费者时,您需要手动执行检查点。使用处理器主机可以解决这个问题。此外,使用处理器主机可以更好地处理负载分配
关于Azure 事件中心(事件处理器主机与直接接收器),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/75604963/