Examples of MqttTopic


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

                sockets.add(sock);
                return sock;
            }
        };
        conOpt.setSocketFactory(testFactory);
        MqttTopic willTopic = client.getTopic(topic);
        conOpt.setWill(willTopic, payload, 0, false);
        conOpt.setCleanSession(false);
        client.connect(conOpt);

        Assert.assertEquals(1, sockets.size());
View Full Code Here

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

        Assert.assertEquals(1, receivedMessages.size());
        client.disconnect();
    }

    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.MqttTopic

        MqttMessage message = new MqttMessage(payload);
        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
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.