This is the Java version of Azure/azure-sdk-for-net#9158, since the Java Client suffers from the same issue.
Also - Unlike .NET (Which does not support resuming from a SequenceNumber from a checkpoint) the Java Client will use the sequence number if provided in the Checkpoint object when resuming (if the offset is null). In this case we also use an inclusive instead of exclusive EventPosition which should mean that the same event is processed when resuming.
|
EventPosition startFromEventPosition = null; |
|
if (checkpoint != null && checkpoint.getOffset() != null) { |
|
startFromEventPosition = EventPosition.fromOffset(checkpoint.getOffset()); |
|
} else if (checkpoint != null && checkpoint.getSequenceNumber() != null) { |
|
startFromEventPosition = EventPosition.fromSequenceNumber(checkpoint.getSequenceNumber(), true); |
|
} else { |
|
startFromEventPosition = initialEventPosition; |
|
} |
Note that the fix for Azure/azure-sdk-for-net#9158 of just adding one to the offset fails in cases where no new events have been published, so we shouldn't blindly copy that logic.
This is the Java version of Azure/azure-sdk-for-net#9158, since the Java Client suffers from the same issue.
Also - Unlike .NET (Which does not support resuming from a SequenceNumber from a checkpoint) the Java Client will use the sequence number if provided in the Checkpoint object when resuming (if the offset is null). In this case we also use an inclusive instead of exclusive EventPosition which should mean that the same event is processed when resuming.
azure-sdk-for-java/sdk/eventhubs/azure-messaging-eventhubs/src/main/java/com/azure/messaging/eventhubs/PartitionPumpManager.java
Lines 123 to 130 in 71ff41a
Note that the fix for Azure/azure-sdk-for-net#9158 of just adding one to the offset fails in cases where no new events have been published, so we shouldn't blindly copy that logic.