Skip to content

[BUG] [EventHubs Track 2] Checkpoint should use exclusive not inclusive offset #6982

Description

@ellismg

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.

Metadata

Metadata

Assignees

Labels

ClientThis issue points to a problem in the data-plane of the library.Event HubsbugThis issue requires a change to an existing behavior in the product in order to be resolved.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions