0
votes

I know that the messages in an event hub expires after a certain period of time depending on how we configure it but is there any way we can delete the events received in an event hub through code or through configuration in the Azure portal as soon as we receive them?

3

3 Answers

1
votes

please go through this documentation for sending and receiving messages in 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

At this time, there is no mechanism to delete all messages. Messages expire automatically beyond their 24 hour retention. 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).

Subscriptions are durable and if you disconnect and reconnect you will see newest messages only the first time you subscribe and not each time i.e. message delivery will commence from newest messages upon first subscription and subsequent reconnects will resume delivery of messages published since you last connected

0
votes

If you want messages deleted once you received them, you might want to consider Azure Service Bus Queues - they support exactly that.

0
votes

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.

If you need mutable messaging then consider Azure Service Bus.