Package org.eclipse.paho.client.mqttv3

Examples of org.eclipse.paho.client.mqttv3.MqttDeliveryToken.waitForCompletion()


    private void publish(MqttClient client, String topicName, int qos, byte[] payload) throws MqttException {
      MqttTopic topic = client.getTopic(topicName);
       MqttMessage message = new MqttMessage(payload);
      message.setQos(qos);
      MqttDeliveryToken token = topic.publish(message);
      token.waitForCompletion();
    }

    public void connectionLost(Throwable cause) {
        if (!expectConnectionFailure)
            fail("Connection unexpectedly lost");
View Full Code Here


        logger.debug("Publishing message {} to topic '{}'",
            deliveryToken.getMessageId(), topic);
        if (!async) {
          // wait for publish confirmation
          deliveryToken.waitForCompletion(10000);
          if (!deliveryToken.isComplete()) {
            logger.error(
                "Did not receive completion message within timeout limit whilst publishing to topic '{}'",
                topic);
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.