Class Checkpoint
- java.lang.Object
-
- com.microsoft.azure.eventprocessorhost.Checkpoint
-
public class Checkpoint extends Object
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
Constructors 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getOffset()
Return the offset.String
getPartitionId()
Get the partition id.long
getSequenceNumber()
Get the sequence number.void
setOffset(String newOffset)
Set the offset.void
setSequenceNumber(long newSequenceNumber)
Set the sequence number.
-
-
-
Constructor Detail
-
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.
-
Checkpoint
public Checkpoint(Checkpoint source)
Create a checkpoint which is a duplicate of the given checkpoint.- Parameters:
source
- Existing checkpoint to clone.
-
-
Method Detail
-
getOffset
public String getOffset()
Return the offset.- Returns:
- the current offset value.
-
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.
-
getSequenceNumber
public long getSequenceNumber()
Get the sequence number.- Returns:
- the current sequence number.
-
setSequenceNumber
public void setSequenceNumber(long newSequenceNumber)
Set the sequence number. Remember to also set the offset!- Parameters:
newSequenceNumber
- the new value for sequence number.
-
getPartitionId
public String getPartitionId()
Get the partition id. There is no corresponding setter because the partition id is immutable.- Returns:
- the associated partition id.
-
-