diff --git a/binding.gyp b/binding.gyp index 563dce5..a738fbb 100644 --- a/binding.gyp +++ b/binding.gyp @@ -27,7 +27,10 @@ "include_dirs": [ " #include #include "pulsar/ClientConfiguration.h" +#include static const std::string CFG_SERVICE_URL = "serviceUrl"; static const std::string CFG_AUTH = "authentication"; @@ -232,11 +233,17 @@ Client::Client(const Napi::CallbackInfo &info) : Napi::ObjectWrap(info) pulsar_client_configuration_set_listener_name(cClientConfig.get(), listenerName.Utf8Value().c_str()); } - try { - this->cClient = std::shared_ptr( - pulsar_client_create(serviceUrl.Utf8Value().c_str(), cClientConfig.get()), pulsar_client_free); + // Set client description to identify this as a Node.js client + // Using the Node.js client version from package.json + std::ostringstream oss; + oss << "node-client-v" << PULSAR_CLIENT_NODE_VERSION; + cClientConfig.get()->conf.setDescription(oss.str()); + + try { + this->cClient = std::shared_ptr( + pulsar_client_create(serviceUrl.Utf8Value().c_str(), cClientConfig.get()), pulsar_client_free); } catch (const std::exception &e) { - Napi::Error::New(env, e.what()).ThrowAsJavaScriptException(); + Napi::Error::New(env, e.what()).ThrowAsJavaScriptException(); } }