com.feingto.iot.server.handler.mqtt.PubackHandler Maven / Gradle / Ivy
package com.feingto.iot.server.handler.mqtt;
import com.feingto.iot.common.Constants;
import com.feingto.iot.server.cache.MessageCache;
import com.feingto.iot.server.handler.BaseMessageHandler;
import io.netty.channel.Channel;
import io.netty.handler.codec.mqtt.MqttMessage;
import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader;
import io.netty.handler.codec.mqtt.MqttMessageType;
/**
* QoS level = 1的PUBLISH消息之后对发送者的响应
*
* @author longfei
*/
public class PubackHandler extends BaseMessageHandler {
public PubackHandler() {
super(MqttMessageType.PUBACK);
}
@Override
public void handle(Channel channel, Object object) {
MqttMessage msg = (MqttMessage) object;
MqttMessageIdVariableHeader variableHeader = (MqttMessageIdVariableHeader) msg.variableHeader();
// 删除持久化消息
MessageCache.getInstance(igniteMessage)
.remove(channel.attr(Constants.KEY_CLIENT_ID).get(), variableHeader.messageId());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy