Messages will be stored on Event Hub
for a specific time interval. Once this time expires messages are removed automatically. As offset
values defines the position of event in the partition
, I'm confused if I'll get the same offset value
next time (after data expires from partition). If so then what is difference between offset
and event sequence
of partition?
1 Answers
TLDR: You will NEVER receive the same offset - even after the data is expired from EventHubs.
Offset: is the address (or pointer or cursor) of your Event on an EventHub Partition. Getting into implementation details, Offset is a struct on our Service (whose underlying value is stuffed into 64 bits - for optimization - and hence a c# long in the client) - representing the address of the event in our service's underlying file-system. If you need to replay the EventHub partition events from a particular point - you will need the Offset. That is exactly what it is built for.
SequenceNumber: is a monotonously increasing number that is STAMPED on every EventData - on Eventhubs Service - to represent the order of events. It is sequential and is intended be used to represent - length of the stream - no. of events on the Partition - by querying GetPartitionRuntimeInfo and diff. between LastEnqueuedSeqNo. and BeginSeqNo.. The receiver could get current received offset (from EventData.Offset) - which if you compare with LastEnqueuedSeqNo. can give - howmuch the receiver is lagging behind by - this is the prime reason why this was built for.
HTH! Sree