public class KafkaUtils extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
protected static long |
ADMIN_CLIENT_CLOSE_TIMEOUT_S |
protected org.apache.kafka.clients.admin.AdminClient |
adminClient |
protected static long |
ALL_CONSUMERS_CACHE_TIMEOUT_MS |
protected List<String> |
allConsumers |
protected long |
allConsumersTime |
static String |
BOOTSTRAP_SERVERS_PROP |
static String |
DEFAULT_BOOTSTRAP_SERVERS |
Constructor and Description |
---|
KafkaUtils() |
KafkaUtils(Properties adminProperties) |
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(String topic,
int partitions,
short replicationFactor) |
void |
createTopicWithoutReplication(String topic,
int partitions) |
static String |
getBootstrapServers() |
protected List<String> |
getConsumerTopics(String group) |
static Properties |
getDefaultAdminProperties() |
int |
getNumberOfPartitions(String topic) |
protected static Collection<org.apache.kafka.common.PartitionInfo> |
getPartsFor(String topic,
int partitions) |
static boolean |
kafkaDetected() |
List<String> |
listAllConsumers() |
List<String> |
listConsumers(String topic) |
Set<String> |
listTopics() |
int |
partitions(String topic) |
static List<List<LogPartition>> |
rangeAssignments(int threads,
Map<String,Integer> streams) |
static List<List<LogPartition>> |
roundRobinAssignments(int threads,
Map<String,Integer> streams) |
boolean |
topicExists(String topic) |
public static final String BOOTSTRAP_SERVERS_PROP
public static final String DEFAULT_BOOTSTRAP_SERVERS
protected final org.apache.kafka.clients.admin.AdminClient adminClient
protected volatile List<String> allConsumers
protected volatile long allConsumersTime
protected static final long ALL_CONSUMERS_CACHE_TIMEOUT_MS
protected static final long ADMIN_CLIENT_CLOSE_TIMEOUT_S
public KafkaUtils()
public KafkaUtils(Properties adminProperties)
public static Properties getDefaultAdminProperties()
public static String getBootstrapServers()
public static boolean kafkaDetected()
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(String topic, int partitions)
public void createTopic(String topic, int partitions, short replicationFactor)
public boolean topicExists(String topic)
public int partitions(String topic)
public Set<String> listTopics()
public List<String> listConsumers(String topic)
protected List<String> getConsumerTopics(String group)
public List<String> listAllConsumers()
public int getNumberOfPartitions(String topic)
public void close()
close
in interface AutoCloseable
Copyright © 2019 Nuxeo. All rights reserved.