Search in sources :

Example 6 with MqttFixedHeader

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

the class MQTTProtocolHandler method sendPublishProtocolControlMessage.

void sendPublishProtocolControlMessage(int messageId, MqttMessageType messageType) {
    MqttQoS qos = (messageType == MqttMessageType.PUBREL) ? MqttQoS.AT_LEAST_ONCE : MqttQoS.AT_MOST_ONCE;
    MqttFixedHeader fixedHeader = new // Spec requires 01 in header for rel
    MqttFixedHeader(// Spec requires 01 in header for rel
    messageType, // Spec requires 01 in header for rel
    false, // Spec requires 01 in header for rel
    qos, false, 0);
    MqttPubAckMessage rel = new MqttPubAckMessage(fixedHeader, MqttMessageIdVariableHeader.from(messageId));
    sendToClient(rel);
}
Also used : MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttPubAckMessage(io.netty.handler.codec.mqtt.MqttPubAckMessage) MqttQoS(io.netty.handler.codec.mqtt.MqttQoS)

Example 7 with MqttFixedHeader

use of io.netty.handler.codec.mqtt.MqttFixedHeader 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

MqttFixedHeader (io.netty.handler.codec.mqtt.MqttFixedHeader)7 MqttMessage (io.netty.handler.codec.mqtt.MqttMessage)2 MqttConnAckMessage (io.netty.handler.codec.mqtt.MqttConnAckMessage)1 MqttConnAckVariableHeader (io.netty.handler.codec.mqtt.MqttConnAckVariableHeader)1 MqttPubAckMessage (io.netty.handler.codec.mqtt.MqttPubAckMessage)1 MqttPublishMessage (io.netty.handler.codec.mqtt.MqttPublishMessage)1 MqttPublishVariableHeader (io.netty.handler.codec.mqtt.MqttPublishVariableHeader)1 MqttQoS (io.netty.handler.codec.mqtt.MqttQoS)1 MqttSubAckMessage (io.netty.handler.codec.mqtt.MqttSubAckMessage)1 MqttSubAckPayload (io.netty.handler.codec.mqtt.MqttSubAckPayload)1 MqttUnsubAckMessage (io.netty.handler.codec.mqtt.MqttUnsubAckMessage)1