How to change solace client name
Hi all,
On the web portal, my connections showing a random generated client name. I would like to ask how can I assign a more meaningful name on the application side?
I am using python apis. I am using config like this by following the hello_world_pubsub.py
example. Thanks
broker_props = { "solace.messaging.transport.host": os.environ.get('SOLACE_HOST') or "tcp://10.40.14.33:20061,tcp://10.40.14.33:20066", "solace.messaging.service.vpn-name": os.environ.get('SOLACE_VPN') or "default", "solace.messaging.authentication.scheme.basic.username": os.environ.get('SOLACE_USERNAME') or "default", "solace.messaging.authentication.scheme.basic.password": os.environ.get('SOLACE_PASSWORD') or "default" }
Best Answers
-
You can pass a
"solace.messaging.client.name"
property to your broker_prop object as followsbroker_props = { "solace.messaging.transport.host": os.environ.get('SOLACE_HOST') or "tcp://10.40.14.33:20061,tcp://10.40.14.33:20066", "solace.messaging.service.vpn-name": os.environ.get('SOLACE_VPN') or "default", "solace.messaging.authentication.scheme.basic.username": os.environ.get('SOLACE_USERNAME') or "default", "solace.messaging.authentication.scheme.basic.password": os.environ.get('SOLACE_PASSWORD') or "default", "solace.messaging.client.name": "some meaningful name" }
2
Answers
-
You can pass a
"solace.messaging.client.name"
property to your broker_prop object as followsbroker_props = { "solace.messaging.transport.host": os.environ.get('SOLACE_HOST') or "tcp://10.40.14.33:20061,tcp://10.40.14.33:20066", "solace.messaging.service.vpn-name": os.environ.get('SOLACE_VPN') or "default", "solace.messaging.authentication.scheme.basic.username": os.environ.get('SOLACE_USERNAME') or "default", "solace.messaging.authentication.scheme.basic.password": os.environ.get('SOLACE_PASSWORD') or "default", "solace.messaging.client.name": "some meaningful name" }
2 -
You can also check the list of all other properties in the documentation here https://docs.solace.com/API-Developer-Online-Ref-Documentation/python/source/rst/solace.messaging.config.solace_properties.html?#module-solace.messaging.config.solace_properties
Hopefully this helps!
1 -
Hi @Tamimi ,
Thanks for your additional information.
I have tried your suggestion
broker_props = { "solace.messaging.transport.host": os.environ.get('SOLACE_HOST') or "tcp://localhost:20061,tcp://localhost:55555,tcp://localhost:55554", "solace.messaging.service.vpn-name": os.environ.get('SOLACE_VPN') or "default", "solace.messaging.authentication.scheme.basic.username": "hello_client", "solace.messaging.authentication.scheme.basic.password": "hello_client_pw", "solace.messaging.client.name": "hello_test_name" } messaging_service = MessagingService.builder().from_properties(broker_props)\ .with_reconnection_retry_strategy(RetryStrategy.parametrized_retry(20,3))\ .build()
The name is still not updated.
I am using python api with version:
solace-pubsubplus==1.2.1
I would like to ask if there is anything I missed ?
Thanks
0