You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "David Z. (JIRA)" <ji...@apache.org> on 2018/09/13 06:54:00 UTC

[jira] [Updated] (AMQ-7045) Lost messages when send from amq to mqtt client

     [ https://issues.apache.org/jira/browse/AMQ-7045?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Z. updated AMQ-7045:
--------------------------
       Patch Info: Patch Available
    Fix Version/s: 5.16.0

> Lost messages when send from amq to mqtt client
> -----------------------------------------------
>
>                 Key: AMQ-7045
>                 URL: https://issues.apache.org/jira/browse/AMQ-7045
>             Project: ActiveMQ
>          Issue Type: Bug
>    Affects Versions: 5.15.3
>         Environment: h1.  
>            Reporter: David Z.
>            Priority: Major
>             Fix For: 5.16.0
>
>
> We use a Java Tomcat application which publish / subscribe jms messages to Active mq and a Android Mobile application which is connected via mqtt to amq. When a Mobile client lost its connection in some case persistent messages get lost. I observerved this behavoiur with different mqtt clients. Here are two cases to reproduce this bug.
> h1. Case 1
> Two clients: Client A connected over mqtt and Client B connected via jms
>  # Client A Subscribe to amq topic with Qos 2 and cleanSession = false
>  # Client B publish Message to topic with persistant flag = true
>  # Client A receive Message with Qos 0
>  # Disconnect client A (Turn on Airplanemode on Android)
>  # same as in step 2
>  # wait several minutes (longer as keep alive intervall)
>  # same as step 2
>  # Connect client A again (Turn off Airplane mode on Android device)
>  # Client A reiceives only message sent in step 7 with Qos = 0, message from step 5 is lost.
> h1. Case 2
> See [https://stackoverflow.com/questions/27189086/activemq-lost-persistent-message-sent-to-detached-consumer-before-keepaliveinter/52096122#52096122]
> h1. Expected Behavoiur
> Messages with persisant flag = true will sent to mqtt client with qos = 1 or 2 (delivered at least once or exactly once)
> Messages with persistant flag = false will sent to mqtt client with qos = 0 (delivered 0 or 1 time)
> h1. Bug
> For me it seems that in File MQTTProtocolConverter on line 588 the constants QoS.AT_MOST_ONCE and QoS.AT_LEAST_ONCE are swapped.
> The line should look like
> {{qoS = message.isPersistent() ? QoS.AT_LEAST_ONCE : QoS.AT_MOST_ONCE ;}} 
> instead of 
> {{qoS = message.isPersistent() ? QoS.AT_MOST_ONCE : QoS.AT_LEAST_ONCE;}}
> A nice feature is when the user can change the mapping between Qos and Persistant Flag in the configuration file. 
> [https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob;f=activemq-mqtt/src/main/java/org/apache/activemq/transport/mqtt/MQTTProtocolConverter.java;h=ff6ee4335a4d27d665d4012f3b85c0ea3b31cfc2;hb=HEAD]
>  
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)