🎄 Happy Holidays! 🥳

Most of Solace is closed December 24–January 1 so our employees can spend time with their families. We will re-open Thursday, January 2, 2024. Please expect slower response times during this period and open a support ticket for anything needing immediate assistance.

Happy Holidays!

Please note: most of Solace is closed December 25–January 2, and will re-open Tuesday, January 3, 2023.

Sending json message using Python to queue using certificate authentication

Pravin
Pravin Member Posts: 4

Is there any way we can send json message to queue using certificate authentication in Python. If possible please share code snippets showing this.

Comments

  • Tamimi
    Tamimi Member, Administrator, Employee Posts: 541 admin

    Hey Parvin! I'm not quite sure what you mean by sending a message using certificate authentication. Are you referring to connecting to a Solace broker using certificate authentication? Or are you referring to sending messages to a queue? And what API are you using to connect to the broker?

    Options to connect to the broker using Python

    1. MQTT: you can use paho mqtt to connect to the broker. For certificate connection, all you need to do it client.tls_set(ca_certs="path_to_.pem_cert")
    2. Solace API: you will need to add this configuration property in your broker config prior connecting to the broker "solace.messaging.tls.trust-store-path": "path_to_.pem_cert"

    Sending messages

    Regardless the option you choose to connect to the broker, you can a JSON formatted body in the message. If you are sending messages on a topic, you can configure your queue on the broker to subscribe to a topic and it will receive the messages with the json body payload you sent from your application

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee

    @Pravin if you mean you would like to use client certificate authentication for your connection (as opposed to basic auth), the Python API supports that. I don't have any code at the moment, but it's mainly just a set of properties in the config. The API docs show this 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.authentication_properties
    Do you have your client certs set up and loaded on the broker?

  • amackenzie
    amackenzie Member, Employee Posts: 269 Solace Employee

    Here is the documentation on how this needs to be set up on the broker.
    https://docs.solace.com/Solace-Cloud/ght_client_certs.htm