public class ZookeeperOffsetHandler extends Object
Constructor and Description |
---|
ZookeeperOffsetHandler(Properties props) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the offset handler.
|
static Long |
getOffsetFromZooKeeper(org.apache.curator.framework.CuratorFramework curatorClient,
String groupId,
String topic,
int partition) |
Map<KafkaTopicPartition,Long> |
getOffsets(List<KafkaTopicPartition> partitions) |
static void |
setOffsetInZooKeeper(org.apache.curator.framework.CuratorFramework curatorClient,
String groupId,
String topic,
int partition,
long offset) |
void |
writeOffsets(Map<KafkaTopicPartition,Long> offsetsToWrite)
Writes given set of offsets for Kafka partitions to ZooKeeper.
|
public ZookeeperOffsetHandler(Properties props)
public void writeOffsets(Map<KafkaTopicPartition,Long> offsetsToWrite) throws Exception
offsetsToWrite
- The offsets for the partitions to write.Exception
- The method forwards exceptions.public Map<KafkaTopicPartition,Long> getOffsets(List<KafkaTopicPartition> partitions) throws Exception
partitions
- The partitions to read offsets for.Exception
- This method forwards exceptions.public void close() throws IOException
IOException
- Thrown, if the handler cannot be closed properly.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.