Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

admin.connect() (Promisified API) does nothing useful #376

Open
@mgillis

Description

In our environment we'd like to loop and wait until Kafka is ready.

With KafkaJS we can simply do something like

while (true) {
 try {
 await admin.connect();
 break;
 } catch (err) {
 // check if this is just saying Kafka is not connectable yet
 // if so continue otherwise rethrow
 }
}

In confluent-kafka-javascript the actual code being run at .connect() is a no-op, see

AdminClient.prototype.connect = function () {
if (!this._hasUnderlyingClient) {
this._client.configureCallbacks(true, this._cb_configs);
LibrdKafkaError.wrap(this._client.connect(), true);
}
// While this could be a no-op for an existing client, we still emit the event
// to have a consistent API.
this._isConnected = true;
this.emit('ready', { name: this._client.name() });
};
- so this continues through and we have to instead do some admin action like list-topics and catch errors from there.

It's not a very intuitive API and I was only able to discover through through source code diving and then confirming on line 184 of admin.js:
"Unlike the other confluent-kafka-javascript classes, this class does not ensure that it is connected to the upstream broker."

I'm opening this issue to also help others looking for help with diagnosing this problem.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /