|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
MQTT Retain message |
« View previous topic :: View next topic » |
Author |
Message
|
anisrao87 |
Posted: Wed Jan 21, 2015 12:45 pm Post subject: MQTT Retain message |
|
|
Newbie
Joined: 21 Jan 2015 Posts: 4
|
Hi,
Need some insight on retaining a message at the broker. I understand by setting the retain parameter to TRUE, the MQTT broker will keep the message for the new subscribers so they can receive the last retained message immediately.
But considering a scenario where a client application publishes 10 different payload messages. At any point, the client doesn't wait for a reply message back from the subscriber. So if my subscriber is down after receiving my 5th message. My client would have published all of its 10 messages and end its task.
When the subscriber comes back, it will only retrieve the last retained message (message#10) leaving messages 6-9 being lost. Is there a way to overcome this without having the client to wait for success message back from subscriber?
Thanks
Anis GovindaRao |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jan 21, 2015 12:51 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Retained messages always have the behavior you talk about, where the current message replaces the old message.
If you want a subscriber to halt for a while, come back, and then receive all messages published between when it stopped and when it started again, you just need to make sure you don't use cleanSession when you reconnect.
As long as the broker remembers the subscription, messages will pile up until they are consumed - to the limit of the number of messages the subscription is allowed to hold. |
|
Back to top |
|
 |
anisrao87 |
Posted: Wed Jan 21, 2015 1:14 pm Post subject: |
|
|
Newbie
Joined: 21 Jan 2015 Posts: 4
|
Thanks for the reply. Don't use CleanSession meaning, MqttConnectOptions will have to set the cleanSession as false. Because the default is true.
Please clarify. |
|
Back to top |
|
 |
anisrao87 |
Posted: Wed Jan 21, 2015 1:27 pm Post subject: |
|
|
Newbie
Joined: 21 Jan 2015 Posts: 4
|
Thanks. I tried with CleanSession disabled and it worked. Appreciate your help on this. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|