0

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?

Charlie S
  • 4,366
  • 6
  • 59
  • 97

1 Answers1

1

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.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • Thanks Mikhail. I tried used InitialOffsetProvider (https://stackoverflow.com/questions/33881020/how-to-set-the-eventprocessorhost-to-read-events-from-now-on-utc?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa), but that wouldnt work. Is that because as you say there is no way to filter events by time? – Charlie S Jun 06 '18 at 15:07