Class PahoMqttV5TransportConnector
java.lang.Object
de.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector
de.iip_ecosphere.platform.transport.connectors.basics.AbstractMqttTransportConnector
de.iip_ecosphere.platform.transport.mqttv5.PahoMqttV5TransportConnector
- All Implemented Interfaces:
de.iip_ecosphere.platform.transport.connectors.TransportConnector
public class PahoMqttV5TransportConnector
extends de.iip_ecosphere.platform.transport.connectors.basics.AbstractMqttTransportConnector
A MQTT v5 connector based on Eclipse Paho. Requires
TransportParameter.getApplicationId().
This implementation is potentially not thread-safe, i.e., it may require a sending queue.- Author:
- Holger Eichelberger, SSE
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThe internal reception callback.Nested classes/interfaces inherited from class de.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector
de.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector.AuthenticationConsumer -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.eclipse.paho.mqttv5.client.MqttAsyncClientstatic final Stringprivate intprivate booleanFields inherited from interface de.iip_ecosphere.platform.transport.connectors.TransportConnector
EMPTY_PARENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidconnect(de.iip_ecosphere.platform.transport.connectors.TransportParameter params) voidgetName()private voidSendsdatatostream.voidsetReceptionCallback(String stream, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<?> callback) voidvoidunsubscribe(String stream, boolean delete) private voidwaitForCompletion(org.eclipse.paho.mqttv5.client.IMqttToken token) Waits for completion until thetokenis processed.Methods inherited from class de.iip_ecosphere.platform.transport.connectors.basics.AbstractMqttTransportConnector
composeNames, composeStreamNameMethods inherited from class de.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector
applyAuthenticationKey, applyAuthenticationKey, applyIdentityToken, applyIdentityToken, createTlsContext, detachReceptionCallback, getActionTimeout, getApplicationId, getApplicationId, getCallback, getCloseAction, getSerializerProvider, getTransportParameter, isStreamKnown, notifyCallback, registerStream, serialize, setSerializerProvider, useTls
-
Field Details
-
NAME
- See Also:
-
client
private org.eclipse.paho.mqttv5.client.MqttAsyncClient client -
tlsEnabled
private boolean tlsEnabled -
qos
private int qos
-
-
Constructor Details
-
PahoMqttV5TransportConnector
public PahoMqttV5TransportConnector()Creates a connector instance.
-
-
Method Details
-
connect
public void connect(de.iip_ecosphere.platform.transport.connectors.TransportParameter params) throws IOException - Specified by:
connectin interfacede.iip_ecosphere.platform.transport.connectors.TransportConnector- Overrides:
connectin classde.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector- Throws:
IOException
-
setReceptionCallback
public void setReceptionCallback(String stream, de.iip_ecosphere.platform.transport.connectors.ReceptionCallback<?> callback) throws IOException - Specified by:
setReceptionCallbackin interfacede.iip_ecosphere.platform.transport.connectors.TransportConnector- Overrides:
setReceptionCallbackin classde.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector- Throws:
IOException
-
unsubscribe
- Specified by:
unsubscribein interfacede.iip_ecosphere.platform.transport.connectors.TransportConnector- Overrides:
unsubscribein classde.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector- Throws:
IOException
-
disconnect
- Specified by:
disconnectin interfacede.iip_ecosphere.platform.transport.connectors.TransportConnector- Overrides:
disconnectin classde.iip_ecosphere.platform.transport.connectors.impl.AbstractTransportConnector- Throws:
IOException
-
asyncSend
- Throws:
IOException
-
syncSend
- Throws:
IOException
-
send
Sendsdatatostream.- Parameters:
stream- the stream to send todata- the data to sendblock- shall this be a blocking or a non-blocking send operation- Throws:
IOException- in case that sending fails for some reason
-
waitForCompletion
private void waitForCompletion(org.eclipse.paho.mqttv5.client.IMqttToken token) throws org.eclipse.paho.mqttv5.common.MqttException Waits for completion until thetokenis processed.- Parameters:
token- the token- Throws:
org.eclipse.paho.mqttv5.common.MqttException- in case that processing of the token fails
-
getName
-
supportedEncryption
-
enabledEncryption
-