Charlie S
Charlie S

Reputation: 4604

Event Hub Listener - get all messages in one go

I am testing an Event Hub. The developers are pushing messages to the Event Hub. I have built an Event Hub Listener to check all the messages are being sent/received correctly. This is the design I used:

https://learn.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-framework-getstarted-receive-eph

The issue I have is there are circa 4 million events on the event hub and the ProcessEventsAsync method seems to get called 4 or 5 times and then stops being called.

Is there a way I can just request to get only the messages added in the last X minutes?

Upvotes: 0

Views: 2697

Answers (1)

Mikhail Shilkov
Mikhail Shilkov

Reputation: 35154

Instead of using EventProcessorHost, you could directly read through all the events. That means you would call Receive method directly to read a batch of events.

See Direct consumer and Service Bus Event Hubs Direct Receivers for code examples.

There is no way to filter events by time (last X seconds), offsets are the only addressable space.

Upvotes: 1

Related Questions