Java Code Examples for io.netty.handler.codec.mqtt.MqttMessageType#UNSUBACK

The following examples show how to use io.netty.handler.codec.mqtt.MqttMessageType#UNSUBACK . 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: MqttProtocolHandler.java    From joyqueue with Apache License 2.0 5 votes vote down vote up
private void sendUnSubAck(Channel client, int packageID, MqttQoS qoS) {
    MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, qoS, false, 0);
    MqttMessage unSubAckMessage = MqttMessageFactory.newMessage(
            mqttFixedHeader,
            MqttMessageIdVariableHeader.from(packageID),
            null);
    LOG.info("UNSUBSCRIBE successful, packageID: {}", packageID);
    client.writeAndFlush(unSubAckMessage);
}
 
Example 2
Source File: MqttMessageFactory.java    From lannister with Apache License 2.0 5 votes vote down vote up
public static MqttUnsubAckMessage unsuback(int messageId) {
	MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false,
			2);
	MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(messageId);

	return new MqttUnsubAckMessage(fixedHeader, variableHeader);
}
 
Example 3
Source File: MessageUtil.java    From iot-mqtt with Apache License 2.0 4 votes vote down vote up
public static MqttUnsubAckMessage getUnSubAckMessage(int messageId){
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK,false,MqttQoS.AT_MOST_ONCE,false,0);
    MqttMessageIdVariableHeader idVariableHeader = MqttMessageIdVariableHeader.from(messageId);
    return new MqttUnsubAckMessage(fixedHeader,idVariableHeader);
}
 
Example 4
Source File: MQTTProtocolHandler.java    From activemq-artemis with Apache License 2.0 4 votes vote down vote up
void handleUnsubscribe(MqttUnsubscribeMessage message) throws Exception {
   session.getSubscriptionManager().removeSubscriptions(message.payload().topics());
   MqttFixedHeader header = new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
   MqttUnsubAckMessage m = new MqttUnsubAckMessage(header, message.variableHeader());
   sendToClient(m);
}
 
Example 5
Source File: MqttEndpointImpl.java    From vertx-mqtt with Apache License 2.0 3 votes vote down vote up
public MqttEndpointImpl unsubscribeAcknowledge(int unsubscribeMessageId) {

    MqttFixedHeader fixedHeader =
      new MqttFixedHeader(MqttMessageType.UNSUBACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttMessageIdVariableHeader variableHeader =
      MqttMessageIdVariableHeader.from(unsubscribeMessageId);

    io.netty.handler.codec.mqtt.MqttMessage unsuback = MqttMessageFactory.newMessage(fixedHeader, variableHeader, null);

    this.write(unsuback);

    return this;
  }