SOHU-Co / kafka-node

Node.js client for Apache Kafka 0.8 and later.
MIT License
2.66k stars 630 forks source link

ConsumerGroupStream does not relay events from ConsumerGroup #847

Open aikar opened 6 years ago

aikar commented 6 years ago

Questions?

Bug Report

Events emitted on the inner consumerGroup instance are not being relayed to the ConsumerGroupStream

This breaks the ability to do consumer.on('connect', () => {}); for example.

It requires you to do consumer.consumerGroup.on('connect') instead.

I suggest events emitted should proxy to the ConsumerGroupStream.

Environment

Example:

        consumer.on('rebalancing', () => {
            if (this._consumerReady.resolved) {
                this._consumerReady = resolvable();
            }
            this.logger.info("Rebalancing");
            this.emit("kafka:rebalance");
        });

        consumer.on('connect', () => { });
flejz commented 5 years ago

Probably because options.connectOnReady is hardcoded to false in ConsumerGroupStream, ignoring the default from the ConsumerGroup instance and the options.

Set manually to true (for testing purpose only) worked for me.