How to change solace client name

sulfred
sulfred Member Posts: 20

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"
    }
Tagged:

Best Answers

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin
    #2 Answer ✓

    You can pass a "solace.messaging.client.name" property to your broker_prop object as follows

    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",
    "solace.messaging.client.name": "some meaningful name"
        }
    
  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin
    #3 Answer ✓

    @sulfred Can you please try updating to 1.3 and try again?

Answers

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin
    #4 Answer ✓

    You can pass a "solace.messaging.client.name" property to your broker_prop object as follows

    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",
    "solace.messaging.client.name": "some meaningful name"
        }
    
  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin
  • sulfred
    sulfred Member Posts: 20

    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

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 538 admin
    #7 Answer ✓

    @sulfred Can you please try updating to 1.3 and try again?