sbmpost commented on code in PR #1152:
URL: https://github.com/apache/pekko-connectors/pull/1152#discussion_r2782456720
##########
mqtt-streaming/src/main/scala/org/apache/pekko/stream/connectors/mqtt/streaming/model.scala:
##########
@@ -978,7 +981,11 @@ object MqttCodec {
: Vector[(Either[DecodeError, String], ControlPacketFlags)] =
if (remainingLen > 0) {
val packetLenAtTopicFilter = v.len
- val topicFilter = (v.decodeString(), ControlPacketFlags(v.getByte
& 0xFF))
+ // 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 left
+ // after receiving the message from the broker. See also:
+ //
https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349311
+ val topicFilter = (v.decodeString(), ControlPacketFlags((v.getByte
<< 1) & 0xFF))
Review Comment:
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]