Class PahoMqttv5Connector<CO,CI>
java.lang.Object
de.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[],CO,CI>
de.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[],CO,CI>
de.iip_ecosphere.platform.connectors.mqttv5.PahoMqttv5Connector<CO,CI>
- Type Parameters:
CO- the output type to the IIP-Ecosphere platformCI- the input type from the IIP-Ecosphere platform
- All Implemented Interfaces:
de.iip_ecosphere.platform.connectors.Connector<byte[],,byte[], CO, CI> de.iip_ecosphere.platform.connectors.events.EventHandlingConnector,de.iip_ecosphere.platform.connectors.model.AbstractModelAccess.NotificationChangedListener
@MachineConnector(hasModel=false,
supportsEvents=true,
supportsHierarchicalQNames=false,
supportsModelCalls=false,
supportsModelProperties=false,
supportsModelStructs=false,
specificSettings={})
public class PahoMqttv5Connector<CO,CI>
extends de.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[],CO,CI>
Implements the generic MQTT v5 connector. Requires
ConnectorParameter.getApplicationId()
and ConnectorParameter.getKeepAlive(). Do not rename, this class is referenced in META-INF/services.
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.static classThe descriptor of this connector (see META-INF/services).Nested classes/interfaces inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
de.iip_ecosphere.platform.connectors.AbstractConnector.BasicAdapterProvider -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate org.eclipse.paho.mqttv5.client.MqttAsyncClientprivate static final de.iip_ecosphere.platform.support.logging.Loggerstatic final Stringprivate booleanFields inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
DEFAULT_CHANNEL -
Constructor Summary
ConstructorsConstructorDescriptionPahoMqttv5Connector(de.iip_ecosphere.platform.connectors.ChannelAdapterSelector<byte[], byte[], CO, CI> selector, de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[], byte[], CO, CI>... adapter) Creates a connector instance.PahoMqttv5Connector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[], byte[], CO, CI>... adapter) Creates a connector instance. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidconnectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) protected voidvoiddispose()protected voidgetName()protected byte[]read()private voidwaitForCompletion(org.eclipse.paho.mqttv5.client.IMqttToken token) Waits for completion until thetokenis processed.protected voidMethods inherited from class de.iip_ecosphere.platform.connectors.AbstractChannelConnector
getOutputChannels, getSelector, initSelector, request, write, writeImplMethods inherited from class de.iip_ecosphere.platform.connectors.AbstractConnector
checkCache, configureAdapter, configureModelAccess, connect, createTlsContext, disconnect, doPolling, enableNotifications, enablePolling, getCachingStrategy, getCachingStrategyCls, getConnectorInputType, getConnectorOutputType, getConnectorParameter, getInitCachingStrategyCls, getInstanceIdentification, getProtocolInputType, getProtocolOutputType, getStorageValue, initializeModelAccess, installPollTask, isPolling, notificationsChanged, notifyDataTimeDifference, notifyReconfigured, received, received, request, setDataTimeDifference, setDataTimeDifferenceProvider, setInstanceIdentification, setReceptionCallback, setStorageValue, trigger, trigger, uninstallPollTask, useTlsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.iip_ecosphere.platform.connectors.Connector
createSharedSpace, disconnectSafe, enableSharedSpace, enumerateFields, enumerateFields, setReceptionCallbackSafe
-
Field Details
-
NAME
- See Also:
-
LOGGER
private static final de.iip_ecosphere.platform.support.logging.Logger LOGGER -
client
private org.eclipse.paho.mqttv5.client.MqttAsyncClient client -
tlsEnabled
private boolean tlsEnabled
-
-
Constructor Details
-
PahoMqttv5Connector
@SafeVarargs public PahoMqttv5Connector(de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[], byte[], CO, CI>... adapter) Creates a connector instance.- Parameters:
adapter- the protocol adapter(s)
-
PahoMqttv5Connector
@SafeVarargs public PahoMqttv5Connector(de.iip_ecosphere.platform.connectors.ChannelAdapterSelector<byte[], byte[], CO, CI> selector, de.iip_ecosphere.platform.connectors.types.ChannelProtocolAdapter<byte[], byte[], CO, CI>... adapter) Creates a connector instance.- Parameters:
selector- the adapter selector (null leads to a default selector for the first adapter)adapter- the protocol adapter(s)
-
-
Method Details
-
connectImpl
protected void connectImpl(de.iip_ecosphere.platform.connectors.ConnectorParameter params) throws IOException - Specified by:
connectImplin classde.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[], CO, CI> - Throws:
IOException
-
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
-
disconnectImpl
- Specified by:
disconnectImplin classde.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[], CO, CI> - Throws:
IOException
-
dispose
public void dispose() -
getName
-
writeImpl
- Specified by:
writeImplin classde.iip_ecosphere.platform.connectors.AbstractChannelConnector<byte[],byte[], CO, CI> - Throws:
IOException
-
read
- Specified by:
readin classde.iip_ecosphere.platform.connectors.AbstractConnector<byte[],byte[], CO, CI> - Throws:
IOException
-
error
-
supportedEncryption
-
enabledEncryption
-