Support configure global level client version string#208
Support configure global level client version string#208BewareMyPower wants to merge 1 commit intoapache:mainfrom
Conversation
### Motivation Currently C++ client generates a `Version.h` based on the `Version.h.in` in the `templates` directory when compiling. The header includes two macros: - `PULSAR_VERSION`: Never used - `PULSAR_VERSION_STR`: Used as the `client_version` field in `CommandConnect` Once the library (e.g. `libpulsar.so`) was built, if the other libraries like the Python and Node.js wrappers use the C++ library, the `client_version` field could not be modified. It causes an issue that when the Python client or Node.client connectes to the broker, the version info is still the C++ client's version because these clients are based on the C++ client. ### Modifications - Add `setClientVersion` and `getClientVersion` functions to set or get the `client_version` field in `CommandConnect`. - To not bring unnecessary mutex overhead, no mutexes are used to protect the access to the global version variable. So the `setClientVersion` method should be called before creating any `Client` object. - Remove the template to generate `Version.h`.
|
Before reviewing this PR, I think we need to start a proposal since it introduces a new API. Here is the discussion before: https://lists.apache.org/thread/n59k537fhthjnzkfxtc2p4zk4l0cv3mp I'm going to start a formal PIP soon. |
|
Is it possible that users are including
FYI, these macros were added in apache/pulsar#12769. These were originally intended to be used by the Pulsar Node.js client, but ended up not being used. |
Oh I see. It will be installed from pre-built binaries. I only checked And from the discussion here, we might support configuring the client version directly on a |
Motivation
Currently C++ client generates a
Version.hbased on theVersion.h.inin thetemplatesdirectory when compiling. The header includes two macros:PULSAR_VERSION: Never usedPULSAR_VERSION_STR: Used as theclient_versionfield inCommandConnectOnce the library (e.g.
libpulsar.so) was built, if the other libraries like the Python and Node.js wrappers use the C++ library, theclient_versionfield could not be modified. It causes an issue that when the Python client or Node.client connectes to the broker, the version info is still the C++ client's version because these clients are based on the C++ client.Modifications
setClientVersionandgetClientVersionfunctions to set or get theclient_versionfield inCommandConnect.setClientVersionmethod should be called before creating anyClientobject.Version.h.