public class TopicPartitionOffset
extends java.lang.Object
null - do nothing;0) - seek to EITHER the absolute offset within the
partition or an offset relative to the current position for this consumer, depending
on isRelativeToCurrent().
consumer.seekToEnd() + initialOffset OR the relative to the
current offset for this consumer (if any), depending on
isRelativeToCurrent().start()ed.
This class is used when manually assigning partitions and for deferred seek operations.| Modifier and Type | Class and Description |
|---|---|
static class |
TopicPartitionOffset.SeekPosition
Enumeration for "special" seeks.
|
| Constructor and Description |
|---|
TopicPartitionOffset(java.lang.String topic,
int partition)
Construct an instance with no initial offset management.
|
TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset)
Construct an instance with the provided initial offset with
isRelativeToCurrent() false. |
TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset,
boolean relativeToCurrent)
Construct an instance with the provided initial offset.
|
TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset,
TopicPartitionOffset.SeekPosition position)
Construct an instance with the provided
TopicPartitionOffset.SeekPosition. |
TopicPartitionOffset(java.lang.String topic,
int partition,
TopicPartitionOffset.SeekPosition position)
Construct an instance with the provided
TopicPartitionOffset.SeekPosition. |
TopicPartitionOffset(org.apache.kafka.common.TopicPartition topicPartition,
java.lang.Long offset,
TopicPartitionOffset.SeekPosition position)
Construct an instance with the provided
TopicPartitionOffset.SeekPosition. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object o) |
java.lang.Long |
getOffset() |
int |
getPartition() |
TopicPartitionOffset.SeekPosition |
getPosition() |
java.lang.String |
getTopic() |
org.apache.kafka.common.TopicPartition |
getTopicPartition() |
int |
hashCode() |
boolean |
isRelativeToCurrent() |
void |
setOffset(java.lang.Long offset)
Set the offset.
|
void |
setRelativeToCurrent(boolean relativeToCurrent)
Set whether the offset is relative to the current position.
|
java.lang.String |
toString() |
public TopicPartitionOffset(java.lang.String topic,
int partition)
topic - the topic.partition - the partition.public TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset)
isRelativeToCurrent() false.topic - the topic.partition - the partition.offset - the offset.TopicPartitionOffset(String, int, Long, boolean)public TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset,
boolean relativeToCurrent)
topic - the topic.partition - the partition.offset - the initial offset.relativeToCurrent - true for the initial offset to be relative to
the current consumer position, false for a positive initial offset to
be absolute and a negative offset relative to the current end of the
partition.public TopicPartitionOffset(java.lang.String topic,
int partition,
TopicPartitionOffset.SeekPosition position)
TopicPartitionOffset.SeekPosition.topic - the topic.partition - the partition.position - TopicPartitionOffset.SeekPosition.public TopicPartitionOffset(java.lang.String topic,
int partition,
java.lang.Long offset,
@Nullable
TopicPartitionOffset.SeekPosition position)
TopicPartitionOffset.SeekPosition.topic - the topic.partition - the partition.offset - the offset from the seek position (or timestamp for
TopicPartitionOffset.SeekPosition.TIMESTAMP).position - TopicPartitionOffset.SeekPosition.public TopicPartitionOffset(org.apache.kafka.common.TopicPartition topicPartition,
java.lang.Long offset,
@Nullable
TopicPartitionOffset.SeekPosition position)
TopicPartitionOffset.SeekPosition.topicPartition - the topic/partition.offset - the offset from the seek position (or timestamp for
TopicPartitionOffset.SeekPosition.TIMESTAMP).position - TopicPartitionOffset.SeekPosition.public org.apache.kafka.common.TopicPartition getTopicPartition()
public int getPartition()
public java.lang.String getTopic()
public java.lang.Long getOffset()
public void setOffset(java.lang.Long offset)
offset - the offset.public boolean isRelativeToCurrent()
public void setRelativeToCurrent(boolean relativeToCurrent)
relativeToCurrent - true for relative to current.public TopicPartitionOffset.SeekPosition getPosition()
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object