Home > Net >  Azure - access retained Events Hub data without Event Hubs Capture option enabled
Azure - access retained Events Hub data without Event Hubs Capture option enabled

Time:10-14

As above. I have IOT stream. Event Hub has retention period of 5 days. Is there a way I can query or dump this historical data?

Thank you

CodePudding user response:

Event Hubs data is not retained beyond the retention policy. In your case, the data is deleted right after 5 days.

CodePudding user response:

As you probably know events are distributed over partitions. When reading the events you do so using a consumer group. Consumer groups enable multiple consuming applications to each have a separate view of the event stream, and to read the stream independently at their own pace and with their own offsets.

Now, this offset is the key to the answer. You can set the offset to the begin of the stream when reading so you can read the older events if they are still available. Do mind that the 5 days specified is the guaranteed minimum amount of days the data is stored. There might be more events still present.

Regarding offsets

An offset is the position of an event within a partition. You can think of an offset as a client-side cursor. The offset is a byte numbering of the event. This offset enables an event consumer (reader) to specify a point in the event stream from which they want to begin reading events. You can specify the offset as a timestamp or as an offset value. Consumers are responsible for storing their own offset values outside of the Event Hubs service. Within a partition, each event includes an offset.

  • Related