public class ZookeeperOffsetHandler extends Object implements OffsetHandler
Constructor and Description |
---|
ZookeeperOffsetHandler(Properties props) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the offset handler, releasing all resources.
|
void |
commit(Map<KafkaTopicPartition,Long> offsetsToCommit)
Commits the given offset for the partitions.
|
static long |
getOffsetFromZooKeeper(org.apache.curator.framework.CuratorFramework curatorClient,
String groupId,
String topic,
int partition) |
Map<KafkaTopicPartition,Long> |
getOffsets(List<KafkaTopicPartition> partitions)
Positions the given fetcher to the initial read offsets where the stream consumption
will start from.
|
static void |
setOffsetInZooKeeper(org.apache.curator.framework.CuratorFramework curatorClient,
String groupId,
String topic,
int partition,
long offset) |
public ZookeeperOffsetHandler(Properties props)
public void commit(Map<KafkaTopicPartition,Long> offsetsToCommit) throws Exception
OffsetHandler
commit
in interface OffsetHandler
offsetsToCommit
- The offset to commit, per partition.Exception
public Map<KafkaTopicPartition,Long> getOffsets(List<KafkaTopicPartition> partitions) throws Exception
OffsetHandler
getOffsets
in interface OffsetHandler
partitions
- The partitions for which to seeks the fetcher to the beginning.Exception
public void close() throws IOException
OffsetHandler
close
in interface OffsetHandler
IOException
- Thrown, if the closing fails.public static void setOffsetInZooKeeper(org.apache.curator.framework.CuratorFramework curatorClient, String groupId, String topic, int partition, long offset) throws Exception
Exception
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.