Bootstrap

KAFKA消费者源码解析

KafkaConsumer

这个类有多种构造函数,分别传入参数Properties、ConsumerConfig等。

订阅函数

subscribe(Collection topics, ConsumerRebalanceListener listener)

acquireAndEnsureOpen();
        try {
   
            if (topics == null) {
   
                throw new IllegalArgumentException("Topic collection to subscribe to cannot be null");
            } else if (topics.isEmpty()) {
   
                // treat subscribing to empty topic list as the same as unsubscribing
                this.unsubscribe();
            } else {
   
                for (String topic : topics) {
   
                    if (topic 
;