Blizzard / node-rdkafka

Node.js bindings for librdkafka
MIT License
2.1k stars 390 forks source link

Add connected event to client #1020

Open constantind opened 1 year ago

constantind commented 1 year ago

OS: linux Node Version : any NPM Version : any C++ Toolchain: g++ node-rdkafka version: any

Currently ready event only triggers once getMetadata is complete if the cluster has hundreds of topics it could take O(n) amount of time, that can result in this here timing out: https://github.com/confluentinc/librdkafka/blob/9b72ca3aa6c49f8f57eea02f70aadb1453d3ba1f/src/rdkafka_metadata.c#L85 configuring timeout and increasing is not ideal which is by default 30s. Probing on 10s until metadata is cached on first run is another option which however causes many retries. A connected event can be emitted before getMetadata in connect() method to be able to implement different handling when metadata call is not necessary.