All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cn.wizzer.iot.mqtt.server.broker.protocol.PubComp Maven / Gradle / Ivy

There is a newer version: 1.2.0-netty
Show newest version
/**
 * 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());
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy