You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by jdanekrh <gi...@git.apache.org> on 2017/06/21 21:18:19 UTC

[GitHub] activemq-artemis pull request #1358: ARTEMIS-1244 propagate retain flag of r...

GitHub user jdanekrh opened a pull request:

    https://github.com/apache/activemq-artemis/pull/1358

    ARTEMIS-1244 propagate retain flag of received message

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jdanekrh/activemq-artemis ARTEMIS-1244_fix-only

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/activemq-artemis/pull/1358.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1358
    
----

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1358: ARTEMIS-1244 propagate retain flag of r...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/activemq-artemis/pull/1358


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1358: ARTEMIS-1244 propagate retain flag of r...

Posted by jdanekrh <gi...@git.apache.org>.
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.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1358: ARTEMIS-1244 propagate retain flag of r...

Posted by michaelandrepearce <gi...@git.apache.org>.
Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1358#discussion_r123484532
  
    --- 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 --
    
    You're correct, this is protected already, and if null will already default to false.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] activemq-artemis pull request #1358: ARTEMIS-1244 propagate retain flag of r...

Posted by michaelandrepearce <gi...@git.apache.org>.
Github user michaelandrepearce commented on a diff in the pull request:

    https://github.com/apache/activemq-artemis/pull/1358#discussion_r123442277
  
    --- 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 --
    
    message.getBooleanProperty returns big B Boolean, as such need to handle case of null.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---