Class OutboundAggregator

java.lang.Object
energy.eddie.aiida.aggregator.Aggregator<AiidaRecord>
energy.eddie.aiida.aggregator.OutboundAggregator
All Implemented Interfaces:
AutoCloseable

@Component public class OutboundAggregator extends Aggregator<AiidaRecord>
  • Constructor Details

    • OutboundAggregator

      public OutboundAggregator(AiidaRecordRepository aiidaRecordRepository, org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry)
  • Method Details

    • addNewDataSourceAdapter

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

      protected void saveRecordToDatabase(AiidaRecord dataRecord)
      Specified by:
      saveRecordToDatabase in class Aggregator<AiidaRecord>
    • getFilteredFlux

      public reactor.core.publisher.Flux<AiidaRecord> getFilteredFlux(Set<ObisCode> allowedDataTags, AiidaAsset allowedAsset, Instant permissionExpirationTime, org.springframework.scheduling.support.CronExpression transmissionSchedule, UUID userId, UUID dataSourceId)
      Returns a Flux of AiidaRecords that either contains all records or only contains records with a AiidaRecordValue.dataTag() that is in the set allowedCodes. All values must have a timestamp before permissionExpirationTime. Additionally, the records are buffered and aggregated by the CronExpression transmissionSchedule.
      Parameters:
      allowedDataTags - Tags which should be included in the returned Flux.
      allowedAsset - The asset that should be included in the returned Flux.
      permissionExpirationTime - Instant when the permission expires.
      transmissionSchedule - The schedule at which the data should be transmitted.
      userId - The user id of the permission creator.
      Returns:
      A Flux on which will only have AiidaRecords with a code matching one of the codes of the allowedCodes set, a timestamp that is before permissionExpirationTime and that are aggregated by the transmissionSchedule.