Skip to content

Conversation

@shibd
Copy link
Member

@shibd shibd commented Mar 26, 2025

Motivation

In the C++ client, the connectionTimeout parameter controls the time allowed to establish a connection, with a default value of 10 seconds

https://github.com/apache/pulsar-client-cpp/blob/4ba83e83fbb4319c0b4cda82372caf042e9ccaa6/lib/ClientConnection.cc#L184-L185

We need to expose this config on node.js client.

Modifications

  • The pulsar_client structure definition from the C++ client has been copied, allowing node.js client to set it using the C++ API instead of the C API.
  • Expose connectionTimeoutMs configuration

Documentation

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@shibd shibd self-assigned this Mar 26, 2025
@hrsakai
Copy link
Contributor

hrsakai commented Apr 24, 2025

This fix itself seems fine, but are there any concerns about using the C++ API in other places?
I'm not sure if the C++ API should be allowed.

@BewareMyPower
Copy link
Contributor

@hrsakai C and C++ API are released as a whole for source code and pre-built binaries. I think the Node.js client uses the C API due to historical reasons. Using C++ API should be okay. They make no difference from a perspective of Node.js client users.

@hrsakai
Copy link
Contributor

hrsakai commented May 9, 2025

@BewareMyPower
Isn't there a possibility that bugs related to object life cycles may occur if we continue to use C++ APIs in the future?

@BewareMyPower
Copy link
Contributor

that bugs related to object life cycles may occur

We already have a handle leak check here:

"test": "jest --verbose --detectOpenHandles",
, and #412 is an example to show how the memory leak is detected.

The C API just wraps the C++ API, so it should not be expected if we turn to the C++ API directly.

Copy link
Contributor

@hrsakai hrsakai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

(Since the C++ API and the C API will be mixed, I would like to consider refactoring it in the future.)

@shibd shibd merged commit f25b90d into apache:master May 14, 2025
12 checks passed
@shibd shibd added this to the 1.14.0 milestone May 26, 2025
shibd added a commit that referenced this pull request May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants