Class InboundAdapter
java.lang.Object
energy.eddie.aiida.adapters.datasource.DataSourceAdapter<InboundDataSource>
energy.eddie.aiida.adapters.datasource.MqttDataSourceAdapter<InboundDataSource>
energy.eddie.aiida.adapters.datasource.inbound.InboundAdapter
- All Implemented Interfaces:
AutoCloseable,org.eclipse.paho.mqttv5.client.MqttCallback,org.springframework.boot.health.contributor.HealthContributor,org.springframework.boot.health.contributor.HealthIndicator
-
Field Summary
Fields inherited from class energy.eddie.aiida.adapters.datasource.MqttDataSourceAdapter
asyncClientFields inherited from class energy.eddie.aiida.adapters.datasource.DataSourceAdapter
dataSource, healthSink, healthValidationMessages, recordSink -
Constructor Summary
ConstructorsConstructorDescriptionInboundAdapter(InboundDataSource dataSource, tools.jackson.databind.ObjectMapper mapper, MqttConfiguration mqttConfiguration) Creates the adapter for the inbound data source. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectComplete(boolean reconnect, String serverURI) Called when the connection to the broker has been established and will then subscribe to the topic specified inmqttConfig.protected org.eclipse.paho.mqttv5.client.MqttConnectionOptionsvoiddeliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) Will always throwUnsupportedOperationException, as this datasource is not designed to publish data.reactor.core.publisher.Flux<InboundRecord> voidmessageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message) MQTT callback function that is called when a new message from the broker is received.Methods inherited from class energy.eddie.aiida.adapters.datasource.MqttDataSourceAdapter
authPacketArrived, close, disconnected, health, mqttErrorOccurred, setKeepAliveInterval, start, subscribeToHealthTopicMethods inherited from class energy.eddie.aiida.adapters.datasource.DataSourceAdapter
create, dataSource, emitAiidaRecordMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.boot.health.contributor.HealthIndicator
health
-
Constructor Details
-
InboundAdapter
public InboundAdapter(InboundDataSource dataSource, tools.jackson.databind.ObjectMapper mapper, MqttConfiguration mqttConfiguration) Creates the adapter for the inbound data source. It connects to the specified MQTT broker and expects that the EP publishes its messages on the specified topic.- Parameters:
dataSource- The entity of the data source.
-
-
Method Details
-
connectComplete
Description copied from class:MqttDataSourceAdapterCalled when the connection to the broker has been established and will then subscribe to the topic specified inmqttConfig.- Specified by:
connectCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback- Overrides:
connectCompletein classMqttDataSourceAdapter<InboundDataSource>- Parameters:
reconnect- If true, the connection was the result of automatic reconnect.serverURI- The server URI that the connection was made to.
-
messageArrived
MQTT callback function that is called when a new message from the broker is received. Will store the message in plaintext format in the database, as this datasource is not designed to parse the messages.- Parameters:
topic- Name of the topic, the message was published to.message- The actual message.
-
deliveryComplete
public void deliveryComplete(org.eclipse.paho.mqttv5.client.IMqttToken token) Description copied from class:MqttDataSourceAdapterWill always throwUnsupportedOperationException, as this datasource is not designed to publish data.- Specified by:
deliveryCompletein interfaceorg.eclipse.paho.mqttv5.client.MqttCallback- Overrides:
deliveryCompletein classMqttDataSourceAdapter<InboundDataSource>- Parameters:
token- The delivery token associated with the message.
-
inboundRecordFlux
-
createConnectOptions
protected org.eclipse.paho.mqttv5.client.MqttConnectionOptions createConnectOptions()- Overrides:
createConnectOptionsin classMqttDataSourceAdapter<InboundDataSource>
-