Class Aggregator<T extends DataSourceRecord>

java.lang.Object
energy.eddie.aiida.aggregator.Aggregator<T>
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
InboundAggregator, OutboundAggregator

public abstract class Aggregator<T extends DataSourceRecord> extends Object implements AutoCloseable
  • Field Details

    • dataSourceAdapters

      protected final List<DataSourceAdapter<? extends DataSource>> dataSourceAdapters
    • healthContributorRegistry

      protected final org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry
    • combinedRecordSink

      protected reactor.core.publisher.Sinks.Many<DataSourceRecord> combinedRecordSink
  • Constructor Details

    • Aggregator

      protected Aggregator(Class<T> recordType, org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry)
  • Method Details

    • addNewDataSourceAdapter

      public void addNewDataSourceAdapter(DataSourceAdapter<? extends DataSource> dataSourceAdapter)
      Adds a new DataSourceAdapter to this aggregator and will subscribe to the Flux returned by DataSourceAdapter.start().
      Parameters:
      dataSourceAdapter - The new data source adapter to add. No check is made if this is a duplicate.
    • removeDataSourceAdapter

      public void removeDataSourceAdapter(DataSourceAdapter<? extends DataSource> dataSourceAdapter)
      Removes a DataSourceAdapter from this aggregator and will close the datasource.
      Parameters:
      dataSourceAdapter - The datasource adapter to remove.
    • close

      public void close()
      Closes all DataSourceAdapters and emits a complete signal for all the Flux returned by DataSourceAdapter.start().
      Specified by:
      close in interface AutoCloseable
    • saveRecordToDatabase

      protected abstract void saveRecordToDatabase(T dataRecord)
    • publishRecordToCombinedFlux

      protected void publishRecordToCombinedFlux(T data)
    • handleCombinedSinkError

      protected void handleCombinedSinkError(Throwable throwable)
    • handleError

      protected void handleError(Throwable throwable, DataSourceAdapter<? extends DataSource> dataSourceAdapter)