Search in sources :

Example 1 with MqttUnsubAckMessage

use of io.netty.handler.codec.mqtt.MqttUnsubAckMessage in project rocketmq-externals by apache.

the class MessageUtil method getMqttUnsubackMessage.

public static MqttUnsubAckMessage getMqttUnsubackMessage(MqttUnsubscribeMessage message) {
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.UNSUBACK, message.fixedHeader().isDup(), message.fixedHeader().qosLevel(), message.fixedHeader().isRetain(), 0);
    MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(message.variableHeader().messageId());
    return new MqttUnsubAckMessage(fixedHeader, variableHeader);
}
Also used : MqttMessageIdVariableHeader(io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader) MqttUnsubAckMessage(io.netty.handler.codec.mqtt.MqttUnsubAckMessage) MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader)

Example 2 with MqttUnsubAckMessage

use of io.netty.handler.codec.mqtt.MqttUnsubAckMessage in project rocketmq-externals by apache.

the class MqttUnsubscribeMessageHandlerTest method assertConditions.

@Override
public void assertConditions() {
    MqttUnsubscribeMessage unsubscribeMessage = (MqttUnsubscribeMessage) message.getPayload();
    MqttUnsubAckMessage ackMessage = embeddedChannel.readOutbound();
    Assert.assertEquals(unsubscribeMessage.variableHeader().messageId(), ackMessage.variableHeader().messageId());
}
Also used : MqttUnsubAckMessage(io.netty.handler.codec.mqtt.MqttUnsubAckMessage) MqttUnsubscribeMessage(io.netty.handler.codec.mqtt.MqttUnsubscribeMessage)

Example 3 with MqttUnsubAckMessage

use of io.netty.handler.codec.mqtt.MqttUnsubAckMessage in project activemq-artemis by apache.

the class MQTTProtocolHandler method handleUnsubscribe.

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);
}
Also used : MqttUnsubAckMessage(io.netty.handler.codec.mqtt.MqttUnsubAckMessage) MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader)

Aggregations

MqttUnsubAckMessage (io.netty.handler.codec.mqtt.MqttUnsubAckMessage)3 MqttFixedHeader (io.netty.handler.codec.mqtt.MqttFixedHeader)2 MqttMessageIdVariableHeader (io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader)1 MqttUnsubscribeMessage (io.netty.handler.codec.mqtt.MqttUnsubscribeMessage)1