Examples of MqttDeliveryToken


Examples of org.eclipse.paho.client.mqttv3.MqttDeliveryToken

    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();
    }
View Full Code Here

Examples of org.eclipse.paho.client.mqttv3.MqttDeliveryToken

        message.setQos(qos);
        message.setRetained(retain);

        // publish message asynchronously
        MqttTopic mqttTopic = client.getTopic(topic);
        MqttDeliveryToken deliveryToken = mqttTopic.publish(message);

        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.