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 |
Constructor and Description |
---|
KafkaUtils() |
KafkaUtils(String zkServers) |
Modifier and Type | Method and Description |
---|---|
protected static List<List<MQPartition>> |
assignments(org.apache.kafka.clients.consumer.internals.PartitionAssignor assignor,
int threads,
Map<String,Integer> streams) |
void |
close() |
void |
createTopic(String topic,
int partitions,
int replicationFactor) |
void |
createTopicWithoutReplication(String topic,
int partitions) |
Set<String> |
getBrokerEndPoints() |
String |
getDefaultBootstrapServers() |
int |
getNumberOfPartitions(String topic) |
protected static Collection<org.apache.kafka.common.PartitionInfo> |
getPartsFor(String topic,
int partitions) |
static boolean |
kafkaDetected() |
static boolean |
kafkaDetected(String zkServers) |
void |
markTopicForDeletion(String topic)
Work only if delete.topic.enable is true which is not the default
|
static List<List<MQPartition>> |
rangeAssignments(int threads,
Map<String,Integer> streams) |
void |
resetConsumerStates(String topic) |
static List<List<MQPartition>> |
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
public KafkaUtils()
public KafkaUtils(String zkServers)
public static boolean kafkaDetected()
public static boolean kafkaDetected(String zkServers)
public void createTopicWithoutReplication(String topic, int partitions)
public void createTopic(String topic, int partitions, int replicationFactor)
public boolean topicExists(String topic)
public void markTopicForDeletion(String topic)
public int getNumberOfPartitions(String topic)
public void resetConsumerStates(String topic)
public Set<String> getBrokerEndPoints()
public String getDefaultBootstrapServers()
public void close() throws Exception
close
in interface AutoCloseable
Exception
public static List<List<MQPartition>> rangeAssignments(int threads, Map<String,Integer> streams)
public static List<List<MQPartition>> roundRobinAssignments(int threads, Map<String,Integer> streams)
protected static List<List<MQPartition>> 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)
Copyright © 2017 Nuxeo. All rights reserved.