cn.wizzer.iot.mqtt.server.broker.protocol.PubComp 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.IDupPubRelMessageStoreService;
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;
/**
* PUBCOMP连接处理
*/
public class PubComp {
private static final Logger LOGGER = LoggerFactory.getLogger(PubComp.class);
private IDupPubRelMessageStoreService dupPubRelMessageStoreService;
public PubComp(IDupPubRelMessageStoreService dupPubRelMessageStoreService) {
this.dupPubRelMessageStoreService = dupPubRelMessageStoreService;
}
public void processPubComp(Channel channel, MqttMessageIdVariableHeader variableHeader) {
int messageId = variableHeader.messageId();
LOGGER.debug("PUBCOMP - clientId: {}, messageId: {}", (String) channel.attr(AttributeKey.valueOf("clientId")).get(), messageId);
dupPubRelMessageStoreService.remove((String) channel.attr(AttributeKey.valueOf("clientId")).get(), variableHeader.messageId());
}
}