Search in sources :

Example 1 with MqttCallbackAdaptor

use of info.xiancloud.mqttclient.MqttCallbackAdaptor in project xian by happyyangyuan.

the class MqttKeepAlive0Test method testKeepAlive0.

@Test
public void testKeepAlive0() {
    MqttCallbackAdaptor callbackAdaptor = new MqttCallbackAdaptor() {

        @Override
        public void messageArrived(String topic, MqttMessage message) throws Exception {
            LOG.info(topic);
            LOG.info(message);
            Thread.sleep(Long.MAX_VALUE);
        }
    };
    String queue = IdManager.generateStaticQueueId("happyyangyuan-test-blocking-queue");
    node = MqttClientBuilder.newBuilder().id(queue).callback(callbackAdaptor).cleanSession(true).qos(0).keepAliveInterval(0).buildPublisher();
    node.connectBroker();
}
Also used : MqttMessage(org.eclipse.paho.client.mqttv3.MqttMessage) MqttCallbackAdaptor(info.xiancloud.mqttclient.MqttCallbackAdaptor) Test(org.junit.Test)

Aggregations

MqttCallbackAdaptor (info.xiancloud.mqttclient.MqttCallbackAdaptor)1 MqttMessage (org.eclipse.paho.client.mqttv3.MqttMessage)1 Test (org.junit.Test)1