From 3baad125f62e7897f654e5974aa7680746bb2caa Mon Sep 17 00:00:00 2001 From: Andrea Selva Date: Wed, 27 Dec 2023 15:53:03 +0100 Subject: [PATCH] CONNACK set shared subscription available property to true (#800) Updates the CONNACK message's property shared subscription available to return reflect the availability of the functionality --- ChangeLog.txt | 1 + broker/src/main/java/io/moquette/broker/MQTTConnection.java | 2 +- .../test/java/io/moquette/integration/mqtt5/ConnectAckTest.java | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 120c68b5c..60d110f66 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -3,6 +3,7 @@ Version 0.18-SNAPSHOT: - Initial implementation of shared subscription subscribe and publish part. (#796) - Added unsubscribe of shared subscriptions. (#799) - Implemented persistence for shared subscriptions to sustain broker restarts (#802) + - CONNACK set shared subscription available property to true. (#800) [fix] Implements requirements on reserved topics (starts with $). Implements the matching rules and avoid to proceed with processing on client's publishes on those topics (#793) [feature] Handle will delay interval and MQTT5's Will optional properties (#770) [fix] Handle empty collector batches in PostOffice (#777) diff --git a/broker/src/main/java/io/moquette/broker/MQTTConnection.java b/broker/src/main/java/io/moquette/broker/MQTTConnection.java index a1269247d..52b55322a 100644 --- a/broker/src/main/java/io/moquette/broker/MQTTConnection.java +++ b/broker/src/main/java/io/moquette/broker/MQTTConnection.java @@ -369,7 +369,7 @@ private ConnAckPropertiesBuilder prepareConnAckPropertiesBuilder(boolean serverG .retainAvailable(true) .wildcardSubscriptionAvailable(true) .subscriptionIdentifiersAvailable(false) - .sharedSubscriptionAvailable(false); + .sharedSubscriptionAvailable(true); return builder; } diff --git a/broker/src/test/java/io/moquette/integration/mqtt5/ConnectAckTest.java b/broker/src/test/java/io/moquette/integration/mqtt5/ConnectAckTest.java index 0a71897da..821470bc2 100644 --- a/broker/src/test/java/io/moquette/integration/mqtt5/ConnectAckTest.java +++ b/broker/src/test/java/io/moquette/integration/mqtt5/ConnectAckTest.java @@ -52,7 +52,7 @@ public void testAckResponseProperties() { verifyProperty(MqttPropertyType.TOPIC_ALIAS_MAXIMUM, ackProps, 0, "No topic alias available"); verifyProperty(MqttPropertyType.WILDCARD_SUBSCRIPTION_AVAILABLE, ackProps, 1, "Wildcard subscription feature is available"); verifyProperty(MqttPropertyType.SUBSCRIPTION_IDENTIFIER_AVAILABLE, ackProps, 0, "Subscription feature is NOT available"); - verifyProperty(MqttPropertyType.SHARED_SUBSCRIPTION_AVAILABLE, ackProps, 0, "Shared subscription feature is NOT available"); + verifyProperty(MqttPropertyType.SHARED_SUBSCRIPTION_AVAILABLE, ackProps, 1, "Shared subscription feature is available"); verifyNotSet(MqttPropertyType.AUTHENTICATION_METHOD, ackProps, "No auth method available"); verifyNotSet(MqttPropertyType.AUTHENTICATION_DATA, ackProps, "No auth data available"); }