activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ARTEMIS-1244) [mqtt] Retain flag of received message is lost (caught by outgoing interceptor)
Date Thu, 22 Jun 2017 10:16:02 GMT

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

ASF GitHub Bot commented on ARTEMIS-1244:
-----------------------------------------

Github user jdanekrh commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1358#discussion_r123471949
  
    --- Diff: artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTPublishManager.java
---
    @@ -256,6 +258,7 @@ void handlePubAck(int messageId) throws Exception {
     
        private void sendServerMessage(int messageId, CoreMessage message, int deliveryCount,
int qos) {
           String address = MQTTUtil.convertCoreAddressFilterToMQTT(message.getAddress().toString(),
session.getWildcardConfiguration());
    +      boolean isRetain = message.getBooleanProperty(new SimpleString(MQTT_MESSAGE_RETAIN_KEY));
    --- End diff --
    
    
    I thought about it, and my conclusion was that since `getBooleanProperty` starts like
this
    
    ```java
       ... Boolean getBooleanProperty(final SimpleString key) throws ... {
          Object value = doGetProperty(key);
          if (value == null) {
             return Boolean.valueOf(null);
    ```
    
    then the only way to get `null` for isRetain would be if somebody explicitly stored a
`null` `Boolean` into the `MQTT_MESSAGE_RETAIN_KEY` property. In which case I though passing
the `null` along is appropriate.
    
    Are you suggesting to do something like
    
        isRetain = Boolean.valueOf(message.getBooleanProperty(...))
    
    to be extra sure? I guess it can do no harm adding it... I'll try do it in CET evening
today.


> [mqtt] Retain flag of received message is lost (caught by outgoing interceptor)
> -------------------------------------------------------------------------------
>
>                 Key: ARTEMIS-1244
>                 URL: https://issues.apache.org/jira/browse/ARTEMIS-1244
>             Project: ActiveMQ Artemis
>          Issue Type: Bug
>          Components: MQTT
>    Affects Versions: 2.1.0
>            Reporter: Michal Toth
>            Priority: Minor
>
> Upstream test: testCheckInterceptedMQTTMessageProperties] [https://github.com/michalxo/activemq-artemis/commit/119e90c6c5bd2ae523e01368544ae3cb66987c4a#diff-d2a66663368a8238bae6dc85ccbd5a5d|org/apache/activemq/artemis/tests/integration/interceptors/MQTTInterceptorPropertiesTest.java
> Asked for PR.
> While implementing an upstream test and checking MQTT Outgoing interceptor, I have noticed
that retain flag set to true is being lost when sending message out.
> However I did not manage to get information about this specific in [3.3.1.3. Retain|http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718038].
> On the other hand I have found a sentence in [HiveMQ|http://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages]
part 8 article:
> {quote}
> Also the subscribing client can identify if a received message was a retained message
or not, because the broker sends out retained messages with the retained flag still set to
true.
> {quote}
> So after all this might be a matter of implementation. (feature enhancement or rejected
bug)



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message