Is there a way to find a specific event in an Azure eventhub

Gerard Martin 21 Reputation points

I'm using c#, and I would like to know if is there a way to read a specific message that is inside an eventhub. Not read them all and then search but have the offset or something similar and make something like a query to get that event

Azure Event Hubs
Azure Event Hubs
An Azure real-time data ingestion service.
569 questions
{count} votes

Accepted answer
  1. MartinJaffer-MSFT 26,036 Reputation points

    Hello @Gerard Martin and welcome to Microsoft Q&A.

    There is not exactly a way to "find" an event. The only controls available within a stream, are partition and checkpoint. Checkpoint is where the event consumer stopped processing when it shut down. The checkpoint is specific to consumer group. I suppose it you manipulated the checkpoint, you could re-read an event, but for that to work, you would need to know what the event's location is.

    If we stop and think about what "find" means, it suggests the results of a search. Even in a database, many records are read before finding the specific record, unless you are fetching by indexed primary key. In both database and event hub, the primary key is not related to the record's contents.

    When reading an event, metadata including sequence and offset is provided. If you recorded this, you could re-visit the same event later. Beyond that, some educated guessing in terms of order/time could be done. If your event data contains a reliable trend, then maybe a O(a log n) time algorithm could work based upon the properties of a sorted sequence and sampling ( a computer science thing).

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful