Skip to content

Conversation

@shibd
Copy link
Member

@shibd shibd commented Jan 28, 2026

Summary

This PR fixes issue #3505 by adding a description parameter to the Node.js client configuration. The default description is set to "node", which causes the client version in topic stats to display as "Pulsar-CPP-vX.Y.Z-node" instead of just "Pulsar-CPP-vX.Y.Z".

Problem

The Node.js client wraps the C++ client library. When connecting to the broker, it uses the C++ client's version string, making it impossible to distinguish Node.js clients from C++ clients in topic statistics. This creates confusion for operators monitoring their Pulsar clusters.

Solution

  • Added description parameter to ClientConfig interface
  • Set default description to "node" to identify the client as Node.js
  • Allow users to override the description if needed
  • Utilize the existing setDescription() method from the C++ ClientConfiguration class

Changes

  • src/Client.cc: Add description configuration parsing and set default value
  • index.d.ts: Add description?: string to ClientConfig interface

Testing

After applying this fix, the clientVersion in topic stats will display as:

  • With default: "Pulsar-CPP-v4.0.0-node"
  • With custom description: "Pulsar-CPP-v4.0.0-node-v1.0.0" (if description is "node-v1.0.0")

Backward Compatibility

This change is fully backward compatible. Existing code will continue to work, and the client version string in topic stats will simply include the additional -node suffix.

Related Issues

Fixes #3505

shibd added 2 commits January 28, 2026 19:41
Add 'description' parameter to Client configuration and set default value to 'node'
so that clientVersion in topic stats displays as 'Pulsar-CPP-vX.Y.Z-node' instead of
just 'Pulsar-CPP-vX.Y.Z'.

This allows operators to distinguish Node.js clients from C++ clients in topic statistics.

Changes:
- Add CFG_DESCRIPTION constant for description configuration parameter
- Parse description from JavaScript client configuration
- Set default description to 'node' to identify as Node.js client
- Add 'description' to TypeScript ClientConfig interface
- Allow users to override description if needed

Fixes #3505
Automatically set client description to 'node-client-vX.Y.Z' using the
Node.js client version from package.json, so that clientVersion in topic
stats displays as 'Pulsar-CPP-vX.Y.Z-node-client-vA.B.C' instead
of just 'Pulsar-CPP-vX.Y.Z'.

This allows operators to distinguish Node.js clients from C++ clients in topic
statistics without requiring users to configure anything.

Changes:
- Add PULSAR_CLIENT_NODE_VERSION define in binding.gyp to read version from package.json
- Set client description to 'node-client-v<version>' in Client constructor
- Remove user-configurable description parameter (not needed, automatic)
- Add <sstream> header for string formatting
- Remove description from TypeScript ClientConfig interface

Fixes #3505
@shibd
Copy link
Member Author

shibd commented Jan 28, 2026

Replacing with updated PR that correctly implements the fix - automatically setting client description without requiring user configuration.

@shibd shibd closed this Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant