public abstract class Subscription extends Object implements Serializable
A subscription to kafka.
Constructor and Description |
---|
Subscription() |
Modifier and Type | Method and Description |
---|---|
abstract String |
getTopicsString() |
void |
refreshAssignment()
NOOP is the default behavior, which means that Kafka will internally handle partition assignment.
|
abstract <K,V> void |
subscribe(org.apache.kafka.clients.consumer.KafkaConsumer<K,V> consumer,
org.apache.kafka.clients.consumer.ConsumerRebalanceListener listener,
TopologyContext context)
Subscribe the KafkaConsumer to the proper topics.
|
public abstract <K,V> void subscribe(org.apache.kafka.clients.consumer.KafkaConsumer<K,V> consumer, org.apache.kafka.clients.consumer.ConsumerRebalanceListener listener, TopologyContext context)
Subscribe the KafkaConsumer to the proper topics. Implementations must ensure that a given topic partition is always assigned to the same spout task. Adding and removing partitions as necessary is fine, but partitions must not move from one task to another. This constraint is only important for use with the Trident spout.
consumer
- the Consumer to get.listener
- the rebalance listener to include in the subscriptionpublic abstract String getTopicsString()
public void refreshAssignment()
NOOP is the default behavior, which means that Kafka will internally handle partition assignment. If you wish to do manual partition management, you must provide an implementation of this method that will check with kafka for any changes and call the ConsumerRebalanceListener from subscribe to inform the rest of the system of those changes.
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.