tulios / kafkajs

A modern Apache Kafka client for node.js
https://kafka.js.org
MIT License
3.75k stars 527 forks source link

Producer and Consumer should be EventEmitters #1621

Open gabegorelick opened 1 year ago

gabegorelick commented 1 year ago

Is your feature request related to a problem? Please describe. Since Producer and Consumer have on methods, I'd expect them be actual NodeJS EventEmitters. But they're not, so code like the following doesn't work:

producer.once(producer.events.DISCONNECT, () => {}) // throws TypeError since `once` is undefined
consumer.removeListener(...) // also not implemented
// etc for every other EventEmitter method

Describe the solution you'd like Have Producer and Consumer implement all EventEmitter methods.