Accessing Messages in Durable Queues using MQTT - solace

I understand that I can consume messages from a Solace Durable Queue using either JCSMP or JMS API. I wonder whether I can consume messages from a Solace Durable Queue using MQTT. I tried but I never get it work. My MQTT client tried to subscribe to Durable Queue name but messages in the queue were not delivered to my MQTT Client.
My scenario is the following:
Clients from the Internet publish messages to some topics in Solace using MQTT while I have some Durable Queues subscribing to these topics to "attract" messages published to these MQTT topics so that I can process them later. I would like to standardize message exchanges to use only MQTT. Therefore, I would like use MQTT to consume messages stored in this Durable Queues too. Any advice how I can do that.
Thank you.

The MQTT protocol does not have the concept of queues.
For your use case, your MQTT clients will need to create a durable session, with QoS 1 subscriptions.
This will cause the Solace Appliance/VMR to create an internal durable queue that will spool messages for the client.

Related

Increase MQTT Time between PUBLISH and PUBCOMP

I have configured a MQTT subscriber in spring using spring mqtt integration. In the handleMessage method I am doing certain business logic which takes time. While testing I noticed that when I am sending bulk number of messages the Broker republishes the same message as an original message (I checked whether the Message payload is duplicate , it was sending as original). The MQTT Broker is publishing the message again even before the Subscriber can send PUCOMP. QOS level is set to 2
You should not be doing long running tasks in the handleMessage callback as this is run on the MQTT Clients network thread.
If you have a long running task you should be handing it off to a separate thread pool to run.

Mosquitto MQTT how we know when topics created

I am using mosquitto MQTT protocol. I want to know when queue created in MQTT broker ,while publishing or subscription or both subscription and publishing?
$SYS/broker/clients/connected displays number of connected clients, at the same can we find number of queues in MQTT broker..?
Thanks in advance..
The short answer is you don't.
MQTT uses topics not queues (this is important as they are very different concepts) and a topic basically only really exists at the moment a message is published to it.
When a message is published the broker checks all the existing subscriptions for any that matches and then delivers that message to those clients with the matching subscription.
A queue is a mechanism where normally messages are collected and each message is only delivers to one client no matter how many are connected to the queue. With a topic messages are delivered to every client that has a matching subscription.

Send messages between two VPN's in same solace Router

I have two durable queues in two different VPN's , but both VPN's on same appliance. Client connects to VPN1 and post messages on durable queue. I want to send same messages to durable queue on VPN2. so the receiving client can consume the same messages. Is this possible using VPN bridges?
Note: Client can connect only to Durable queue to send/receive messages.
Is this possible using VPN bridges?
Yes. You can create a local loopback VPN bridge between the two VPNs to move messages from one VPN to another.
Instructions to configure a VPN bridge can be found over at http://docs.solace.com/Configuring-and-Managing-Routers/Configuring-VPN-Bridges.htm

Persistent Message Delivery Mode when a Queue subscribes to a Topic

I have a queue subscribing from a topic. My MQTT client publishes messages to the topic. My Java program consumes messages from the queue using JCSMP API. However, I notice that the delivery mode of the messages received by my Java program from the Queue is DIRECT or sometimes NON-PERSISTENT. So, does this mean my messages will not be spooled to SAN? Is it possible for me to set topic subscription for my queue so that all messages received from the topic and stored in this queue will be persistent?
Thank you.
When the Solace appliance receives a message that was published to a topic that matches a topic subscription set on a queue, the message will be delivered to the queue and spooled. If this message is originally set with a DIRECT delivery mode, the delivery mode will be promoted to NON-PERSISTENT. NON-PERSISTENT messages are treated as a Guaranteed Message and will be spooled.
If you are receiving a NON-PERSISTENT message, the message was properly spooled on the queue.
When the Solace appliance receives a message that was published to a topic that matches a topic subscription applied directly on a client, they message will not be spooled and will be delivered directly to the client without being queued. If this message is originally published with a NON-PERSISTENT or PERSISTENT delivery mode, it will be demoted and received by the client as DIRECT.
If you are receiving messages with a delivery mode of DIRECT, verify that the client is not directly subscribed to the topic. The topic should be applied on the queue that the client is bound to instead.

MQTT: Message queuing at server side

I am using mqtt to implement one of the kind of email notification system. I am also planning to use it for trigger notifications inside the webapp. I am confused between whether MQTT stores data at server side itself when we throw on MQTT url with publisher id in JSON format? The reason i am asking this is because in my case, the MQTT stores only the last thrown data, if i send another one then the previous one get disappeared. I want to know is it present at MQTT side from birth(as MQ stands for Message queuing) & i haven't used or need to be implemented at server/consumer side?
There is a common error on Internet ... MQTT stands for MQ Telemetry Transport and not Message Queueing Telemetry Transport. It was created by IBM (with Eurotech) and it was part of the MQ products family in IBM.
MQTT hasn't queue. The broker receives the message on a topic and forwards it on all subscribers on that topic.
There are two main variations on this behaviour:
If the publisher send a message with the "retain" flag active, the broker store this message (only this). If a client subscribes to that topic, the broker immediately sends this last storage message. It's so called "last known message"
If the subscriber connects to the broker with "clean session" to false, the broker saves all subscriptions and all messages only if the client is offline. It's like a queue but not a very queue. With "clean session" false, if the client goes offline but some publishers send messages to topic it is subscribed, the broker store these messages. When the client returns online, it will receive all messages lost.
Paolo.

Resources