Checkpoint Class

  • java.lang.Object
    • com.microsoft.azure.eventprocessorhost.Checkpoint

public class Checkpoint

Checkpoint class is public so that advanced users can implement an ICheckpointManager. Unless you are implementing ICheckpointManager you should not have to deal with objects of this class directly.

A Checkpoint is essentially just a tuple. It has a fixed partition id, set at creation time and immutable thereafter, and associates that with an offset/sequenceNumber pair which indicates a position within the events in that partition.

Constructor Summary

Constructor Description
Checkpoint(Checkpoint source)

Create a checkpoint which is a duplicate of the given checkpoint.

Checkpoint(String partitionId)

Create a checkpoint with offset/sequenceNumber set to the start of the stream.

Checkpoint(String partitionId, String offset, long sequenceNumber)

Create a checkpoint with the given offset and sequenceNumber. It is important that the offset and sequence number refer to the same event in the stream. The safest thing to do is get both values from the system properties of one EventData instance.

Method Summary

Modifier and Type Method and Description
String getOffset()

Return the offset.

String getPartitionId()

Get the partition id. There is no corresponding setter because the partition id is immutable.

long getSequenceNumber()

Get the sequence number.

void setOffset(String newOffset)

Set the offset. Remember to also set the sequence number!

void setSequenceNumber(long newSequenceNumber)

Set the sequence number. Remember to also set the offset!

Constructor Details

Checkpoint

public Checkpoint(Checkpoint source)

Create a checkpoint which is a duplicate of the given checkpoint.

Parameters:

source - Existing checkpoint to clone.

Checkpoint

public Checkpoint(String partitionId)

Create a checkpoint with offset/sequenceNumber set to the start of the stream.

Parameters:

partitionId - Associated partition.

Checkpoint

public Checkpoint(String partitionId, String offset, long sequenceNumber)

Create a checkpoint with the given offset and sequenceNumber. It is important that the offset and sequence number refer to the same event in the stream. The safest thing to do is get both values from the system properties of one EventData instance.

Parameters:

partitionId - Associated partition.
offset - Offset in the stream.
sequenceNumber - Sequence number in the stream.

Method Details

getOffset

public String getOffset()

Return the offset.

Returns:

the current offset value.

getPartitionId

public String getPartitionId()

Get the partition id. There is no corresponding setter because the partition id is immutable.

Returns:

the associated partition id.

getSequenceNumber

public long getSequenceNumber()

Get the sequence number.

Returns:

the current sequence number.

setOffset

public void setOffset(String newOffset)

Set the offset. Remember to also set the sequence number!

Parameters:

newOffset - the new value for offset in the stream.

setSequenceNumber

public void setSequenceNumber(long newSequenceNumber)

Set the sequence number. Remember to also set the offset!

Parameters:

newSequenceNumber - the new value for sequence number.

Applies to