MQTT QoS 1 Queue name

jesper
jesper Member Posts: 8

Hello @all,

when creating a queue on the Solace Broker with an MQTT Client 3.1.1 and QoS 1 the queue name consists of two parts

#mqtt/{client id}/{3 digits numeric id}

For example:

#mqtt/MQTTFOGarticleStore/351

#mqtt/MQTTFOGarticleStore/347


When connecting with the client the numeric id changes. Is there a way we can fix the numeric id? We want to do this because we want to check whether the MQTT queue is there or not.


Best regards

Jens

Comments

  • mstobo
    mstobo Member, Employee Posts: 24 Solace Employee

    Hi @jesper,

    Are you connecting with a clean session. If so, Solace will create a new queue when you connect. If you want the same queue then you have to make sure you're connecting with clean session = false and QoS = 1.

    regards,

    Matt

  • jesper
    jesper Member Posts: 8

    I am sorry but my mqtt client is not able to work with clean session = 0 or false. It is a build in mqtt client in an SAP system and I cannot replace or upgrade the client.

  • mstobo
    mstobo Member, Employee Posts: 24 Solace Employee

    If you are getting a queue, your QoS is already set to 1 so we don't have to worry about that. What SAP system are you using and perhaps I can help find out if the session can be changed or not? It is a boolean, so sometimes it is just a checkbox like in SAP Plant Connectivity.

    Clean Session if Connection Was Interrupted .... If you select the checkbox, any messages that have been missed during an interruption to the connection are not sent when the connection is restored. If you do not select the checkbox, and the connection is interrupted, the MQTT server sends all missed messages as soon as the connection has been restored.

  • jesper
    jesper Member Posts: 8

    Hi,

    we are using a sap netweaver system with

    SAP_BASIS 745 and SP-Level 0005

    SAP_ABA 75E and SP-Level 0005

    There is implemented a mqtt interface and in class CL_MQTT_CLIENT and method IF_MQTT_CLIENT~CONNECT there is no support for clean session false.

    ABAP code ---------------------------------------------------------------------------------------------------------------------

      CALL METHOD cl_mqtt_krn_services=>mqtt_connect

        EXPORTING

          i_apc_client_conn_id       = lv_apc_client_id

          i_timeout_ms               = lv_mqtt_connect_timeout

          i_mqtt_client_id           = lv_mqtt_client_id

          i_mqtt_clean_session       = abap_true " no support for clean session = false yet !

    ABAP code ----------------------------------------------------------------------------------------------------------------------

    So that's the reason i want to check the existence of an mqtt queue in the solace broker.

    Best regards

    Jens


  • mstobo
    mstobo Member, Employee Posts: 24 Solace Employee

    Unfortunately, if you can't do "clean session = false", then according to the spec and how we implemented it you will get a new session when you connect or reconnect and for Solace that also means a new queue. Here's a good document that explains how that works with the spec, http://www.steves-internet-guide.com/mqtt-clean-sessions-example/. What you could do is on the OT side use MQTT as the publisher, and on the IT side consume with another Solace API or RDP from a queue that attracts the messages with a subscription. That way you'll have a durable queue if you get disconnected. Once SAP implements "clean sessions. = false" then you can go back to an end-to-end mqtt solution if you wish.

  • jesper
    jesper Member Posts: 8

    I would like to stay with my mqtt solution because we want to make the consuming SAP system to control the message flow.

    Back to my first question. Is there a way to fix the three digits id numer in the queue name, so we can checkt if a defined queue is there or not?

    example:

    #mqtt/MQTTFOGarticleStore/351

    Kind regards

    Jens

  • mstobo
    mstobo Member, Employee Posts: 24 Solace Employee

    No, not that I know of, as you're getting a new queue (hence a new queue name based on the properties you pointed out initially) every time you connect or reconnect. For a definitive answer or a desired change in implementation, I'd suggest opening a support ticket.