Example usage for io.netty.handler.codec.mqtt MqttMessageBuilders subscribe

List of usage examples for io.netty.handler.codec.mqtt MqttMessageBuilders subscribe

Introduction

In this page you can find the example usage for io.netty.handler.codec.mqtt MqttMessageBuilders subscribe.

Prototype

public static SubscribeBuilder subscribe() 

Source Link

Usage

From source file:io.moquette.spi.impl.AbstractProtocolProcessorCommonUtils.java

License:Open Source License

protected void subscribe(EmbeddedChannel channel, String topic, MqttQoS desiredQos) {
    MqttSubscribeMessage subscribe = MqttMessageBuilders.subscribe().addSubscription(desiredQos, topic)
            .messageId(1).build();//from  w  w w.  j  a v a 2 s  .c  o  m
    this.m_processor.processSubscribe(channel, subscribe);
    MqttSubAckMessage subAck = channel.readOutbound();
    assertEquals(desiredQos.value(), (int) subAck.payload().grantedQoSLevels().get(0));

    final String clientId = NettyUtils.clientID(channel);
    Subscription expectedSubscription = new Subscription(clientId, new Topic(topic), desiredQos);
    verifySubscriptionExists(m_sessionStore, expectedSubscription);
}

From source file:io.moquette.spi.impl.AbstractProtocolProcessorCommonUtils.java

License:Open Source License

protected MqttSubAckMessage subscribeWithoutVerify(String topic, MqttQoS desiredQos) {
    MqttSubscribeMessage subscribe = MqttMessageBuilders.subscribe().addSubscription(desiredQos, topic)
            .messageId(1).build();//w  ww  .  j av  a  2 s . c  om
    this.m_processor.processSubscribe(m_channel, subscribe);
    return m_channel.readOutbound();
}

From source file:io.moquette.spi.impl.AbstractProtocolProcessorCommonUtils.java

License:Open Source License

protected void subscribeAndNotReadResponse(String topic, MqttQoS desiredQos) {
    MqttSubscribeMessage subscribe = MqttMessageBuilders.subscribe().addSubscription(desiredQos, topic)
            .messageId(1).build();/*  w w w  .  j a v  a2s  . c om*/
    this.m_processor.processSubscribe(m_channel, subscribe);
}