public final class KafkaUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
deleteTopic(String zkServers,
String topic) |
static void |
maybeCreateTopic(String zkServers,
String topic,
int partitions) |
static void |
maybeCreateTopic(String zkServers,
String topic,
int partitions,
Properties topicProperties) |
static void |
setOffsets(String zkServers,
String groupID,
Map<Pair<String,Integer>,Long> offsets) |
static boolean |
topicExists(String zkServers,
String topic) |
public static void maybeCreateTopic(String zkServers, String topic, int partitions)
zkServers - Zookeeper server string: host1:port1[,host2:port2,...]topic - topic to create (if not already existing)partitions - number of topic partitionspublic static void maybeCreateTopic(String zkServers, String topic, int partitions, Properties topicProperties)
zkServers - Zookeeper server string: host1:port1[,host2:port2,...]topic - topic to create (if not already existing)partitions - number of topic partitionstopicProperties - optional topic config propertiespublic static boolean topicExists(String zkServers, String topic)
zkServers - Zookeeper server string: host1:port1[,host2:port2,...]topic - topic to check for existencetrue if and only if the given topic existspublic static void deleteTopic(String zkServers, String topic)
zkServers - Zookeeper server string: host1:port1[,host2:port2,...]topic - topic to delete, if it existspublic static void setOffsets(String zkServers, String groupID, Map<Pair<String,Integer>,Long> offsets)
zkServers - Zookeeper server string: host1:port1[,host2:port2,...]groupID - consumer group to updateoffsets - mapping of (topic and) partition to offset to push to ZookeeperCopyright © 2014–2018. All rights reserved.