Class SinapsiAlfaAdapter

All Implemented Interfaces:
AutoCloseable, org.eclipse.paho.mqttv5.client.MqttCallback, org.springframework.boot.actuate.health.HealthContributor, org.springframework.boot.actuate.health.HealthIndicator

public class SinapsiAlfaAdapter extends MqttDataSourceAdapter<SinapsiAlfaDataSource>
  • Constructor Details

    • SinapsiAlfaAdapter

      public SinapsiAlfaAdapter(SinapsiAlfaDataSource dataSource, com.fasterxml.jackson.databind.ObjectMapper mapper, MqttConfiguration mqttConfiguration)
      Creates the datasource for the Sinapsi ALFA adapter. It connects to the specified MQTT broker and expects that the adapter publishes its JSON messages on the specified topic. Any OBIS code without a time field will be assigned a Unix timestamp of 0.
      Parameters:
      dataSource - The entity of the data source.
      mapper - ObjectMapper that is used to deserialize the JSON messages.
      mqttConfiguration - The MQTT configuration that is used to connect to the MQTT broker.
  • Method Details

    • messageArrived

      public void messageArrived(String topic, org.eclipse.paho.mqttv5.common.MqttMessage message)
      MQTT callback function that is called when a new message from the broker is received. Will convert the message to AiidaRecords and publish them on the Flux returned by MqttDataSourceAdapter.start().
      Parameters:
      topic - Name of the topic, the message was published to.
      message - The actual message.
    • createConnectOptions

      protected org.eclipse.paho.mqttv5.client.MqttConnectionOptions createConnectOptions()
      Overrides:
      createConnectOptions in class MqttDataSourceAdapter<SinapsiAlfaDataSource>