@Internal public class Kafka08PartitionDiscoverer extends AbstractPartitionDiscoverer
AbstractPartitionDiscoverer.ClosedException, AbstractPartitionDiscoverer.WakeupException
Constructor and Description |
---|
Kafka08PartitionDiscoverer(KafkaTopicsDescriptor topicsDescriptor,
int indexOfThisSubtask,
int numParallelSubtasks,
Properties kafkaProperties) |
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnections()
Close all established connections.
|
List<KafkaTopicPartition> |
getAllPartitionsForTopics(List<String> topics)
Fetch the list of all partitions for a specific topics list from Kafka.
|
protected List<String> |
getAllTopics()
Fetch the list of all topics from Kafka.
|
List<KafkaTopicPartitionLeader> |
getPartitionLeadersForTopics(List<String> topics)
Send request to Kafka to get partitions for topics.
|
protected void |
initializeConnections()
Establish the required connections in order to fetch topics and partitions metadata.
|
protected void |
wakeupConnections()
Attempt to eagerly wakeup from blocking calls to Kafka in
AbstractPartitionDiscoverer.getAllTopics()
and AbstractPartitionDiscoverer.getAllPartitionsForTopics(List) . |
close, discoverPartitions, open, setAndCheckDiscoveredPartition, wakeup
public Kafka08PartitionDiscoverer(KafkaTopicsDescriptor topicsDescriptor, int indexOfThisSubtask, int numParallelSubtasks, Properties kafkaProperties)
protected void initializeConnections()
AbstractPartitionDiscoverer
initializeConnections
in class AbstractPartitionDiscoverer
protected List<String> getAllTopics()
AbstractPartitionDiscoverer
getAllTopics
in class AbstractPartitionDiscoverer
public List<KafkaTopicPartition> getAllPartitionsForTopics(List<String> topics)
AbstractPartitionDiscoverer
getAllPartitionsForTopics
in class AbstractPartitionDiscoverer
protected void wakeupConnections()
AbstractPartitionDiscoverer
AbstractPartitionDiscoverer.getAllTopics()
and AbstractPartitionDiscoverer.getAllPartitionsForTopics(List)
.
If the invocation indeed results in interrupting an actual blocking Kafka call, the implementations
of AbstractPartitionDiscoverer.getAllTopics()
and
AbstractPartitionDiscoverer.getAllPartitionsForTopics(List)
are responsible of throwing a
AbstractPartitionDiscoverer.WakeupException
.
wakeupConnections
in class AbstractPartitionDiscoverer
protected void closeConnections() throws Exception
AbstractPartitionDiscoverer
closeConnections
in class AbstractPartitionDiscoverer
Exception
public List<KafkaTopicPartitionLeader> getPartitionLeadersForTopics(List<String> topics)
topics
- The name of the topics.Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.