Drain Queue via MQTT

marc_mhp
marc_mhp Member Posts: 1

Hi everybody,

I'm trying to drain a queue via MQTT.

My queue is confingured like this:

Following https://docs.solace.com/Messaging/Reserved-Topics.htm and https://docs.solace.com/API/MQTT/MQTT-Topics.htm#Special I created a client that subscribes to the Topics (_P2P/QUE/test-queue, _P2P/QTMP/v:default/test-queue ) that should be able to drain messages from the queue.

But I don't receive any message that is in the queue. What am I doing wrong here?

Thanks,

Marc

Tagged:

Answers

  • RobO
    RobO Member, Employee Posts: 19 Solace Employee

    In general, you will not be able to drain an existing queue with an MQTT client. Recommend looking at one of our other APIs to consider consumption from queues.
    The special subscription you have created above will allow you to receive new messages that are written to the queue 'test-queue'. But that is only for new messages. In addition, the new message that was targeted for the 'test-queue' will still be on the queue since there is no connection to the queue and hence no ack.
    If you need persistence w/ MQTT, use QoS=1 and clean start to get durable sessions which will persist subscriptions and messages during the time in which a MQTT client is disconnected.
    Can you provide any more context into what you are trying to accomplish?

This Week's Leaders