public interface KafkaSubscriber extends Serializable
Regex
.
The KafkaSubscriber provides a unified interface for the Kafka source to support all these three types of subscribing mode.
Modifier and Type | Interface and Description |
---|---|
static class |
KafkaSubscriber.PartitionChange
A container class to hold the newly added partitions and removed partitions.
|
Modifier and Type | Method and Description |
---|---|
KafkaSubscriber.PartitionChange |
getPartitionChanges(org.apache.kafka.clients.admin.AdminClient adminClient,
Set<org.apache.kafka.common.TopicPartition> currentAssignment)
Get the partitions changes compared to the current partition assignment.
|
static KafkaSubscriber |
getPartitionSetSubscriber(Set<org.apache.kafka.common.TopicPartition> partitions) |
static KafkaSubscriber |
getTopicListSubscriber(List<String> topics) |
static KafkaSubscriber |
getTopicPatternSubscriber(Pattern topicPattern) |
KafkaSubscriber.PartitionChange getPartitionChanges(org.apache.kafka.clients.admin.AdminClient adminClient, Set<org.apache.kafka.common.TopicPartition> currentAssignment)
Although Kafka partitions can only expand and will not shrink, the partitions may still disappear when the topic is deleted.
adminClient
- The admin client used to retrieve partition information.currentAssignment
- the partitions that are currently assigned to the source readers.static KafkaSubscriber getTopicListSubscriber(List<String> topics)
static KafkaSubscriber getTopicPatternSubscriber(Pattern topicPattern)
static KafkaSubscriber getPartitionSetSubscriber(Set<org.apache.kafka.common.TopicPartition> partitions)
Copyright © 2014–2022 The Apache Software Foundation. All rights reserved.