From 82e5ca7e7f88bed458262168ef538e5fa8ca7c27 Mon Sep 17 00:00:00 2001 From: luffyke Date: Tue, 31 Mar 2020 03:23:23 +0800 Subject: [PATCH] Replace MQTT deprecated API usage Motivation: Mqtt procotol defines packetId instead of messageId, replace deprecated method to match protocol definition Modification: Replace messageId() to packetId() in MqttEncoder Result: Match mqtt protocol definition and improve readability. --- .../src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java b/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java index c9379d7ffb..29eeb6cc29 100644 --- a/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java +++ b/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttEncoder.java @@ -323,7 +323,7 @@ public final class MqttEncoder extends MessageToMessageEncoder { buf.writeShort(topicNameBytes.length); buf.writeBytes(topicNameBytes); if (mqttFixedHeader.qosLevel().value() > 0) { - buf.writeShort(variableHeader.messageId()); + buf.writeShort(variableHeader.packetId()); } buf.writeBytes(payload);