[ 
https://issues.apache.org/jira/browse/AMQ-6575?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049331#comment-16049331
 ] 

Matthias Meiners edited comment on AMQ-6575 at 6/14/17 4:14 PM:
----------------------------------------------------------------

There was a 
[post|http://activemq.2283324.n4.nabble.com/Publish-Retained-MQTT-Message-issue-tt4686326.html#none]
 on mailing list that could help:
{quote}
We did some performance test based on ActiveMQ 5.10, found publish mqtt message 
with retain enabled is much faster than disable retain.

And I also tested the retained message will be lost after restart activemq node.

Checked the source code,the line#621 in class 
"org.apache.activemq.transport.mqtt.MQTTProtocolConverter" is confusing,
 msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE && !command.retain());

Should it be following logic?
msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE || command.retain());

Based on MQTT Spec : 
http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
Retained messages should be kept over restarts of the server. 
{quote}

The issue seems to be critical to me. You can't rely on the whole 
retain-feature unless your broker is never down or you need a workaround like 
peridic republishing of messages by the clients.


was (Author: meth):
There was a 
[post|http://activemq.2283324.n4.nabble.com/Publish-Retained-MQTT-Message-issue-tt4686326.html#none]
 on mailing list that could help:
{quote}
We did some performance test based on ActiveMQ 5.10, found publish mqtt message 
with retain enabled is much faster than disable retain.

And I also tested the retained message will be lost after restart activemq node.

Checked the source code,the line#621 in class 
"org.apache.activemq.transport.mqtt.MQTTProtocolConverter" is confusing,
 msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE && !command.retain());

Should it be following logic?
msg.setPersistent(command.qos() != QoS.AT_MOST_ONCE || command.retain());

Based on MQTT Spec : 
http://public.dhe.ibm.com/software/dw/webservices/ws-mqtt/mqtt-v3r1.html
Retained messages should be kept over restarts of the server. 
{quote}

> 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
>
> *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
(v6.4.14#64029)

Reply via email to