confluentinc / confluentinc/confluent-kafka-javascript

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

Open
#376 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
304
Forks
45
Avg merge
11h 47m
Merged PRs (30d)
5

Description

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

With KafkaJS we can simply do something like
```js
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 https://github.com/confluentinc/confluent-kafka-javascript/blob/3ae9609b67860ff18f1191a8baf732e14d719dc6/lib/admin.js#L227-L236 - 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.