sbmpost commented on code in PR #1152:
URL: https://github.com/apache/pekko-connectors/pull/1152#discussion_r2782458131


##########
mqtt-streaming/src/main/scala/org/apache/pekko/stream/connectors/mqtt/streaming/model.scala:
##########
@@ -712,7 +711,11 @@ object MqttCodec {
       v.topicFilters.foreach {
         case (topicFilter, topicFilterFlags) =>
           topicFilter.encode(packetBsb)
-          packetBsb.putByte(topicFilterFlags.underlying.toByte)
+          // Pekko QoS constants have been defined as (0, 2, 4), which for 
most MQTT messages correctly maps to bits 1 and 2.
+          // However for the MQTT Subcribe message, the QoS is encoded in bits 
1 and 0. So here we need to shift to the right
+          // before sending the message to the broker. See also:
+          // 
https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349311
+          packetBsb.putByte((topicFilterFlags.underlying >> 1).toByte)

Review Comment:
   Same as above: We may consider doing this extra validation step, although I 
am not quite sure if it is really worth it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to