You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2018/11/20 15:39:38 UTC
[incubator-plc4x] 01/02: - Fixed the MQTT example after API changes
in the MQTT-Bee project
This is an automated email from the ASF dual-hosted git repository.
cdutz pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
commit d33bfbd0a648cbcd669f4146252f4f6b9613e1af
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Tue Nov 20 16:13:09 2018 +0100
- Fixed the MQTT example after API changes in the MQTT-Bee project
---
.../plc4x/java/examples/connectivity/mqtt/MqttConnector.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java b/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
index 948f11d..685f63d 100644
--- a/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
+++ b/examples/hello-connectivity-mqtt/src/main/java/org/apache/plc4x/java/examples/connectivity/mqtt/MqttConnector.java
@@ -35,7 +35,7 @@ import org.apache.plc4x.java.examples.connectivity.mqtt.model.Configuration;
import org.apache.plc4x.java.examples.connectivity.mqtt.model.PlcFieldConfig;
import org.mqttbee.api.mqtt.MqttClient;
import org.mqttbee.api.mqtt.datatypes.MqttQos;
-import org.mqttbee.api.mqtt.mqtt3.Mqtt3Client;
+import org.mqttbee.api.mqtt.mqtt3.Mqtt3RxClient;
import org.mqttbee.api.mqtt.mqtt3.message.connect.connack.Mqtt3ConnAck;
import org.mqttbee.api.mqtt.mqtt3.message.publish.Mqtt3Publish;
import org.mqttbee.api.mqtt.mqtt3.message.publish.Mqtt3PublishResult;
@@ -73,15 +73,15 @@ public class MqttConnector {
private void run() throws PlcException {
// Create a new MQTT client.
- final Mqtt3Client client = MqttClient.builder()
+ final Mqtt3RxClient client = MqttClient.builder()
.identifier(UUID.randomUUID().toString())
.serverHost(config.getMqttConfig().getServerHost())
.serverPort(config.getMqttConfig().getServerPort())
.useMqttVersion3()
- .buildReactive();
+ .buildRx();
// Connect to the MQTT broker.
- final Single<Mqtt3ConnAck> connAckSingle = client.connect().keepAlive(10, TimeUnit.SECONDS).done();
+ final Single<Mqtt3ConnAck> connAckSingle = client.connect().timeout(10, TimeUnit.SECONDS);
// Connect to the PLC.
try (PlcConnection plcConnection = new PlcDriverManager().getConnection(config.getPlcConfig().getConnection())) {