Class MqttConnector
java.lang.Object
io.openems.edge.controller.api.mqtt.MqttConnector
This helper class wraps a connection to an MQTT broker.
One main feature of this class is to retry the initial connection to an MQTT broker. A feature that is unfortunately not present in Eclipse Paho. After the first successful connection, Paho reconnects on its own in case of a lost connection.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletableFuture<org.eclipse.paho.mqttv5.client.IMqttClient>
protected CompletableFuture<org.eclipse.paho.mqttv5.client.IMqttClient>
connect
(String serverUri, String clientId, String username, String password, org.eclipse.paho.mqttv5.client.MqttCallback callback) protected void
-
Constructor Details
-
MqttConnector
public MqttConnector()
-
-
Method Details
-
deactivate
protected void deactivate() -
connect
protected CompletableFuture<org.eclipse.paho.mqttv5.client.IMqttClient> connect(String serverUri, String clientId, String username, String password) throws IllegalArgumentException, org.eclipse.paho.mqttv5.common.MqttException - Throws:
IllegalArgumentException
org.eclipse.paho.mqttv5.common.MqttException
-
connect
protected CompletableFuture<org.eclipse.paho.mqttv5.client.IMqttClient> connect(String serverUri, String clientId, String username, String password, org.eclipse.paho.mqttv5.client.MqttCallback callback) throws IllegalArgumentException, org.eclipse.paho.mqttv5.common.MqttException - Throws:
IllegalArgumentException
org.eclipse.paho.mqttv5.common.MqttException
-