Solace MQTT

Options
triptesh
triptesh Member Posts: 27

Hi community, I have two queries for using MQTT with Solace

(1) Can we set TTL for QoS 1 , so that for the created Queue , the same TTL is associated with it ?

(2) Can we bind second consumer to an exclusive queue which has been already created before by another consumer ? We noticed with java-mqtt-paho library, when we try to consume with the second consumer from the queue, the first consumer gets disconnected.


Thanks,

Triptesh

Tagged:

Answers

  • marc
    marc Member, Administrator, Moderator, Employee Posts: 936 admin
    edited April 2022 #2
    Options

    Hi @triptesh,

    I went digging internally to get some more info in order to answer this properly, so here it goes:

    (1) Can we set TTL for QoS 1 , so that for the created Queue , the same TTL is associated with it ?

    TLDR: use queue template + set "message expiry interval" on sent messages

    Longer explanation: As you might know, MQTT itself doesn't have queues, only topics. However on a Solace broker when using QoS 1 aspects of MQTT queues are used as part of the internal implementation. When a client subscribes to a topic at QoS 1, the Solace broker creates a queue endpoint and adds a subscription for that topic to the queue. So, in order to use TTL functionality we need to set "respect TTL" on this queue, which is NOT the default. We can leverage the queue templates feature to set this across multiple clients. @amackenzie do you know if there is an example of this? or do you have any guidance? Then on the publisher side of think you would need to use mqtt5 and set "message expiry interval" on publish messages.

    (2) Can we bind second consumer to an exclusive queue which has been already created before by another consumer ? We noticed with java-mqtt-paho library, when we try to consume with the second consumer from the queue, the first consumer gets disconnected.

    TLDR: No, the MQTT spec itself prohibits it

    Longer explanation: From an MQTT perspective the concept of a queue doesn't exist. It is just used as part of the internal Solace implementation of MQTT. The internal queue name is determined using the MQTT client identifier, so in order for two MQTT clients to bind to the same session state's queue, they must have the same client identifier. But, MQTT §3.1.4 requires that if a client connects with the same client identifier as an already existing connection, that the previously existing connection must be disconnected. So, transitively the MQTT spec itself prohibits two MQTT clients from binding to the Solace queue, used under the covers, at the same time.

  • triptesh
    triptesh Member Posts: 27
    Options

    Hi @marc , Thanks for providing details explanation !