Search in sources :

Example 1 with MqttSubscribePayload

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

the class MqttSubscribeMessageHandlerTest method getMqttSubscribeMessage.

private MqttSubscribeMessage getMqttSubscribeMessage() {
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBSCRIBE, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(1);
    List<MqttTopicSubscription> subscriptions = new ArrayList<>();
    subscriptions.add(new MqttTopicSubscription("topic1", MqttQoS.AT_MOST_ONCE));
    subscriptions.add(new MqttTopicSubscription("topic2", MqttQoS.AT_LEAST_ONCE));
    MqttSubscribePayload payload = new MqttSubscribePayload(subscriptions);
    return new MqttSubscribeMessage(fixedHeader, variableHeader, payload);
}
Also used : MqttMessageIdVariableHeader(io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader) MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttSubscribeMessage(io.netty.handler.codec.mqtt.MqttSubscribeMessage) MqttTopicSubscription(io.netty.handler.codec.mqtt.MqttTopicSubscription) ArrayList(java.util.ArrayList) MqttSubscribePayload(io.netty.handler.codec.mqtt.MqttSubscribePayload)

Example 2 with MqttSubscribePayload

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

the class ConsumeMessageIntegrationTest method getMqttSubscribeMessage.

private MqttSubscribeMessage getMqttSubscribeMessage() {
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBSCRIBE, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(subscribePacketId);
    MqttSubscribePayload payload = new MqttSubscribePayload(subscriptions);
    return new MqttSubscribeMessage(fixedHeader, variableHeader, payload);
}
Also used : MqttMessageIdVariableHeader(io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader) MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttSubscribeMessage(io.netty.handler.codec.mqtt.MqttSubscribeMessage) MqttSubscribePayload(io.netty.handler.codec.mqtt.MqttSubscribePayload)

Example 3 with MqttSubscribePayload

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

the class PubSubIntegrationTest method getMqttSubscribeMessage.

private MqttSubscribeMessage getMqttSubscribeMessage() {
    MqttFixedHeader fixedHeader = new MqttFixedHeader(MqttMessageType.SUBSCRIBE, false, MqttQoS.AT_MOST_ONCE, false, 0);
    MqttMessageIdVariableHeader variableHeader = MqttMessageIdVariableHeader.from(consumerSubscribeId);
    MqttSubscribePayload payload = new MqttSubscribePayload(topicSubscriptions);
    return new MqttSubscribeMessage(fixedHeader, variableHeader, payload);
}
Also used : MqttMessageIdVariableHeader(io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader) MqttFixedHeader(io.netty.handler.codec.mqtt.MqttFixedHeader) MqttSubscribeMessage(io.netty.handler.codec.mqtt.MqttSubscribeMessage) MqttSubscribePayload(io.netty.handler.codec.mqtt.MqttSubscribePayload)

Aggregations

MqttFixedHeader (io.netty.handler.codec.mqtt.MqttFixedHeader)3 MqttMessageIdVariableHeader (io.netty.handler.codec.mqtt.MqttMessageIdVariableHeader)3 MqttSubscribeMessage (io.netty.handler.codec.mqtt.MqttSubscribeMessage)3 MqttSubscribePayload (io.netty.handler.codec.mqtt.MqttSubscribePayload)3 MqttTopicSubscription (io.netty.handler.codec.mqtt.MqttTopicSubscription)1 ArrayList (java.util.ArrayList)1