简体   繁体   English

从事件中心接收和删除消息

[英]Receive and Delete messages from Event Hub

我知道事件中心中的消息会在一段时间后过期,具体取决于我们如何配置它,但是有什么方法可以通过代码或 Azure 门户中的配置删除事件中心中接收到的事件接收它们?

please go through this documentation for sending and receiving messages in eventhub;请仔细阅读此文档以在 eventhub 中发送和接收消息;

https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-framework-getstarted-send https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-java-get-started-send https://docs.microsoft.com/en-us/azure/event-hubs /event-hubs-dotnet-framework-getstarted-send

At this time, there is no mechanism to delete all messages.目前,没有删除所有消息的机制。 Messages expire automatically beyond their 24 hour retention.邮件会在超过 24 小时保留期后自动过期。 If you care about messages only from the time you subscribe, you can do a one time subscription with SubscribeRecency of newest (check the java sdk for exact value).如果您只关心订阅时的消息,您可以使用最新的 SubscribeRecency 进行一次性订阅(检查 java sdk 以获取确切值)。

Subscriptions are durable and if you disconnect and reconnect you will see newest messages only the first time you subscribe and not each time ie message delivery will commence from newest messages upon first subscription and subsequent reconnects will resume delivery of messages published since you last connected订阅是持久的,如果您断开连接并重新连接,您只会在第一次订阅时看到最新消息,而不是每次都看到消息传递将从第一次订阅时的最新消息开始,随后的重新连接将恢复自上次连接以来发布的消息的传递

如果您希望在收到消息后将其删除,您可能需要考虑Azure 服务总线队列- 它们完全支持这一点。

Event Hubs provide an immutable append-only log, in other words, events are not supposed to be changed once they are created.事件中心提供不可变的仅追加日志,换句话说,事件一旦创建就不应更改。 Think an EH message as an event at a point in time therefore you cannot go past in time and change an event.将 EH 消息视为某个时间点的事件,因此您无法及时更改事件。

If you need mutable messaging then consider Azure Service Bus.如果需要可变消息传递,请考虑 Azure 服务总线。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM