cn.wizzer.iot.mqtt.server.broker.protocol.PubAck Maven / Gradle / Ivy
/**
* Copyright (c) 2018, Mr.Wang ([email protected]) All rights reserved.
*/
package cn.wizzer.iot.mqtt.server.broker.protocol;
import cn.wizzer.iot.mqtt.server.common.message.IDupPublishMessageStoreService;
import cn.wizzer.iot.mqtt.server.common.message.IMessageIdService;
import io.netty.channel.Channel;
import io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader;
import io.netty.util.AttributeKey;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* PUBACK连接处理
*/
public class PubAck {
private static final Logger LOGGER = LoggerFactory.getLogger(PubAck.class);
private IDupPublishMessageStoreService dupPublishMessageStoreService;
public PubAck(IDupPublishMessageStoreService dupPublishMessageStoreService) {
this.dupPublishMessageStoreService = dupPublishMessageStoreService;
}
public void processPubAck(Channel channel, MqttMessageIdVariableHeader variableHeader) {
int messageId = variableHeader.messageId();
LOGGER.debug("PUBACK - clientId: {}, messageId: {}", (String) channel.attr(AttributeKey.valueOf("clientId")).get(), messageId);
dupPublishMessageStoreService.remove((String) channel.attr(AttributeKey.valueOf("clientId")).get(), messageId);
}
}