问题
I'm consuming from a single Azure EventHub partition, using the PartitionReceiver class in Java. I'm trying to understand the x-opt-sequence-number
SystemProperty that is available in each EventData object that I receive.
Is it guaranteed that the sequence numbers increment by 1 per EventData consumed and that each possible sequence number exists in the partition? For example if I've consumed an Event with sequence number 5 and another with 10, based on this must there exist events with sequence numbers 6-9?
Thanks!
回答1:
Corrected Context
My understanding was incorrect. It has been confirmed by the Event Hubs team that sequence numbers are contiguous within the scope of a single partition.
Original Answer
As I understand it, sequence numbers are not guaranteed to be sequential in the scope of a partition, though they often are. The only strict guarantee is that they will always be in increasing order with respect to when an event was enqueued to a specific partition. Sequence numbers are specific to a partition and shouldn't be compared across partitions.
If you need to ensure that you're sequencing with a strict and specific increment, your best bet is likely to be adding a custom bit of metadata for your application domain's sequence number in the user properties collection. Of course, that does get tricky when coordinating across publishers on multiple machines and like likely to surface performance trade-offs.
来源:https://stackoverflow.com/questions/61121044/is-it-guaranteed-that-sequence-numbers-will-increment-by-1-eventhub