Java Code Examples for io.netty.handler.codec.mqtt.MqttMessage#variableHeader()

The following examples show how to use io.netty.handler.codec.mqtt.MqttMessage#variableHeader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientProtocolProcess.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * B - P (Qos1)
 * @param channel
 * @param mqttMessage
 */
public void processPubAck(Channel channel, MqttMessage mqttMessage) {
	MqttMessageIdVariableHeader messageIdVariableHeader = (MqttMessageIdVariableHeader) mqttMessage
			.variableHeader();
	int messageId = messageIdVariableHeader.messageId();

	producerProcess.processPubAck(messageId);
	producerProcess.delMessage(messageId);
}
 
Example 2
Source File: ClientProtocolProcess.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * B- P(Qos2)
 * @param channel
 * @param mqttMessage
 */
public void processPubRec(Channel channel, MqttMessage mqttMessage) {
	MqttMessageIdVariableHeader messageIdVariableHeader = (MqttMessageIdVariableHeader) mqttMessage
			.variableHeader();
	int messageId = messageIdVariableHeader.messageId();

	producerProcess.processPubRec(messageId);
	producerProcess.sendPubRel(messageId);
}
 
Example 3
Source File: ClientProtocolProcess.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * B - P (Qos2)
 * @param channel
 * @param mqttMessage
 */
public void processPubComp(Channel channel, MqttMessage mqttMessage) {
	MqttMessageIdVariableHeader messageIdVariableHeader = (MqttMessageIdVariableHeader) mqttMessage
			.variableHeader();
	int messageId = messageIdVariableHeader.messageId();

	producerProcess.processPubComp(messageId);
	producerProcess.delMessage(messageId);
}
 
Example 4
Source File: ClientProtocolProcess.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * B - S(Qos2)
 * @param channel
 * @param mqttMessage
 */
public void processPubRel(Channel channel, MqttMessage mqttMessage) {
	MqttMessageIdVariableHeader messageIdVariableHeader = (MqttMessageIdVariableHeader) mqttMessage
			.variableHeader();
	int messageId = messageIdVariableHeader.messageId();
	this.consumerProcess.processPubRel(messageId);
	this.consumerProcess.sendPubCompMessage(messageId);
	this.consumerProcess.delMesage(messageId);
}
 
Example 5
Source File: ClientProtocolProcess.java    From ext-opensource-netty with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * B - S
 * @param channel
 * @param mqttMessage
 */
public void processUnSubBack(Channel channel, MqttMessage mqttMessage) {
	int messageId;
	if (mqttMessage instanceof MqttUnsubAckMessage) {
		MqttUnsubAckMessage mqttUnsubAckMessage = (MqttUnsubAckMessage) mqttMessage;
		messageId = mqttUnsubAckMessage.variableHeader().messageId();
	} else {
		MqttMessageIdVariableHeader o = (MqttMessageIdVariableHeader) mqttMessage.variableHeader();
		messageId = o.messageId();
		NettyLog.error("not UnsubAckMessage:{}", messageId);
	}
	this.consumerProcess.processUnSubBack(messageId);
}
 
Example 6
Source File: MessageUtil.java    From iot-mqtt with Apache License 2.0 4 votes vote down vote up
public static int getMessageId(MqttMessage mqttMessage){
    MqttMessageIdVariableHeader idVariableHeader = (MqttMessageIdVariableHeader) mqttMessage.variableHeader();
    return idVariableHeader.messageId();
}