您能否保证将事件恰好一次发布到事件中心?
我知道向消费者传递单个事件中心消息至少一次,并且我可以看到大量与此相关的文档。但是,如果我是事件发布者,是否可以保证我的事件仅发布到流一次?
鉴于我可能无法收到指示发布消息是否成功的响应,我别无选择,只能重试。有什么因素可以阻止我的活动在集线器上重复吗?
I know delivery of a single event hub message to a consumer is at-least-once and I can see plenty of documentation around this. However, if I'm the event publisher do I have any guarantees of my event being published to the stream exactly once?
Given I can fail to receive the response indicating publishing the message was a success or not, I have no choice but to retry. Is there anything preventing my event being duplicated on the hub?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不;事件中心生态系统中不保证恰好一次。
也就是说,如果您愿意依赖 Beta 版本,Azure.Messaging .EventHubs 在 v5.7.0-beta.x 中引入了一个新的缓冲生产者,它支持幂等重试。启用此功能后,生产者使用的隐式重试将有助于防止重复。
但是,值得注意的是,这是尽力而为,并且不会改变至少一次保证。无论发布时是否存在重复事件,消费者都应该预期并防止读取重复事件。
要启用它,您需要配置缓冲生产者,类似于:
有关缓冲生产者的更多信息可以在 < a href="https://github.com/jsquire/azure-sdk-for-net/blob/main/sdk/eventhub/Azure.Messaging.EventHubs/samples/Sample04_PublishingEvents.md" rel="nofollow noreferrer">SDK 的发布事件示例。
尽管我们目前的目标是五月初,但我们还没有确定其稳定版本的具体日期。请注意,我们不建议在关键生产场景中使用 beta 包。
No; there are no guarantees of exactly-once within the Event Hubs ecosystem.
That said, if you're willing to take a dependency on a beta version, Azure.Messaging.EventHubs introduced a new buffered producer in v5.7.0-beta.x which supports idempotent retries. When this feature is enabled, the implicit retries that the producer uses will help to guard against duplicates.
It's important to note, however, that this is best effort and does not change the at-least-once guarantee. Regardless of duplicates when publishing, consumers should expect and guard against reading duplicate events.
To enable it, you'd configure the buffered producer similar to:
More information on the buffered producer can be found in the Publishing Events sample for the SDK.
We do not yet have a firm date for its stable release, though we're currently aiming for early May. Please be aware that we do not recommend using beta packages in critical production scenarios.