You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Gary Tully (JIRA)" <ji...@apache.org> on 2018/06/27 12:47:00 UTC
[jira] [Comment Edited] (AMQ-6575) Retained messages not persisted?
(MQTT)
[ https://issues.apache.org/jira/browse/AMQ-6575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16524993#comment-16524993 ]
Gary Tully edited comment on AMQ-6575 at 6/27/18 12:46 PM:
-----------------------------------------------------------
[~meth] I was in that area of the code today and came to the same conclusion but then thinking more I think the durability of the message, whether it is persistent or not, needs to come from the publish QoS.
I am thinking the code should be:
{code:java}
msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE);{code}
ie: the retain flag does not effect the durability of the message, just that it gets retained for that topic.
with this change, retain messages with qos > 0 will survive a restart for subscribers. retain with qos == 0 will not.
was (Author: gtully):
[~meth] I was in that area of the code today and came to the same conclusion but then thinking more I think the durability of the message, whether it is persistent or not, needs to come from the publish QoS.
I am thinking the code should be:
{code:java}
msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE);{code}
ie: the retain flag does not effect the durability of the message, just that it gets retained for that topic.
with this change, retain messages with qos > 0 will survive a restart for subscribers.
> Retained messages not persisted? (MQTT)
> ---------------------------------------
>
> Key: AMQ-6575
> URL: https://issues.apache.org/jira/browse/AMQ-6575
> Project: ActiveMQ
> Issue Type: Bug
> Components: Broker, MQTT
> Affects Versions: 5.14.3
> Reporter: Stefan Nilsson
> Priority: Major
>
> *Issue*
> Retained message is not persisted (after restart?)
> *Steps to reproduce*
> # Client *c1* connects and publishes a message *m1* to topic *t1* with retain: *true* and QoS: *2*. Client then disconnects.
> # Client connect (with same clientId or different, both works) and *c1* subscribes to *t1*. *c1* recieves *m1*.
> However, if the broker is restarted and *step 2* is re-run, the *m1* is never recieved.
> Shouldn't a retained message with QoS-2 be persisted and send to clients even after restart?
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)