public class KafkaUtils extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ZK_SERVER |
static int |
ZK_CONNECTION_TIMEOUT_MS |
static int |
ZK_TIMEOUT_MS |
protected org.I0Itec.zkclient.ZkClient |
zkClient |
protected kafka.utils.ZkUtils |
zkUtils |
Constructor and Description |
---|
KafkaUtils() |
KafkaUtils(String zkServers) |
Modifier and Type | Method and Description |
---|---|
protected static List<List<LogPartition>> |
assignments(org.apache.kafka.clients.consumer.internals.PartitionAssignor assignor,
int threads,
Map<String,Integer> streams) |
void |
close() |
void |
createTopic(Properties properties,
String topic,
int partitions,
short replicationFactor) |
void |
createTopicWithoutReplication(Properties properties,
String topic,
int partitions) |
protected static org.I0Itec.zkclient.ZkClient |
createZkClient(String zkServers) |
protected static kafka.utils.ZkUtils |
createZkUtils(String zkServers,
org.I0Itec.zkclient.ZkClient zkClient) |
Set<String> |
getBrokerEndPoints() |
protected List<String> |
getConsumerTopics(Properties props,
String group) |
String |
getDefaultBootstrapServers() |
int |
getNumberOfPartitions(Properties properties,
String topic) |
protected static Collection<org.apache.kafka.common.PartitionInfo> |
getPartsFor(String topic,
int partitions) |
static boolean |
kafkaDetected() |
static boolean |
kafkaDetected(String zkServers) |
List<String> |
listAllConsumers(Properties props) |
List<String> |
listConsumers(Properties props,
String topic) |
List<String> |
listTopics() |
void |
markTopicForDeletion(String topic)
Work only if delete.topic.enable is true which is not the default
|
static List<List<LogPartition>> |
rangeAssignments(int threads,
Map<String,Integer> streams) |
void |
resetConsumerStates(String topic) |
static List<List<LogPartition>> |
roundRobinAssignments(int threads,
Map<String,Integer> streams) |
boolean |
topicExists(String topic) |
public static final String DEFAULT_ZK_SERVER
public static final int ZK_TIMEOUT_MS
public static final int ZK_CONNECTION_TIMEOUT_MS
protected final org.I0Itec.zkclient.ZkClient zkClient
protected final kafka.utils.ZkUtils zkUtils
public KafkaUtils()
public KafkaUtils(String zkServers)
public static boolean kafkaDetected()
public static boolean kafkaDetected(String zkServers)
protected static kafka.utils.ZkUtils createZkUtils(String zkServers, org.I0Itec.zkclient.ZkClient zkClient)
protected static org.I0Itec.zkclient.ZkClient createZkClient(String zkServers)
public static List<List<LogPartition>> rangeAssignments(int threads, Map<String,Integer> streams)
public static List<List<LogPartition>> roundRobinAssignments(int threads, Map<String,Integer> streams)
protected static List<List<LogPartition>> assignments(org.apache.kafka.clients.consumer.internals.PartitionAssignor assignor, int threads, Map<String,Integer> streams)
protected static Collection<org.apache.kafka.common.PartitionInfo> getPartsFor(String topic, int partitions)
public void createTopicWithoutReplication(Properties properties, String topic, int partitions)
public void createTopic(Properties properties, String topic, int partitions, short replicationFactor)
public boolean topicExists(String topic)
public List<String> listTopics()
public List<String> listConsumers(Properties props, String topic)
protected List<String> getConsumerTopics(Properties props, String group)
public List<String> listAllConsumers(Properties props)
public void markTopicForDeletion(String topic)
public int getNumberOfPartitions(Properties properties, String topic)
public void resetConsumerStates(String topic)
public Set<String> getBrokerEndPoints()
public String getDefaultBootstrapServers()
public void close()
close
in interface AutoCloseable
Copyright © 2018 Nuxeo. All rights reserved.