Package energy.eddie.aiida.aggregator
Class OutboundAggregator
java.lang.Object
energy.eddie.aiida.aggregator.Aggregator<AiidaRecord>
energy.eddie.aiida.aggregator.OutboundAggregator
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields inherited from class energy.eddie.aiida.aggregator.Aggregator
combinedRecordSink, dataSourceAdapters, healthContributorRegistry -
Constructor Summary
ConstructorsConstructorDescriptionOutboundAggregator(AiidaRecordRepository aiidaRecordRepository, org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNewDataSourceAdapter(DataSourceAdapter<? extends DataSource> dataSourceAdapter) Adds a newDataSourceAdapterto this aggregator and will subscribe to the Flux returned byDataSourceAdapter.start().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 ofAiidaRecords that either contains all records or only contains records with aAiidaRecordValue.dataTag()that is in the setallowedCodes.protected voidsaveRecordToDatabase(AiidaRecord dataRecord) Methods inherited from class energy.eddie.aiida.aggregator.Aggregator
close, handleCombinedSinkError, handleError, publishRecordToCombinedFlux, removeDataSourceAdapter
-
Constructor Details
-
OutboundAggregator
public OutboundAggregator(AiidaRecordRepository aiidaRecordRepository, org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry)
-
-
Method Details
-
addNewDataSourceAdapter
Description copied from class:AggregatorAdds a newDataSourceAdapterto this aggregator and will subscribe to the Flux returned byDataSourceAdapter.start().- Overrides:
addNewDataSourceAdapterin classAggregator<AiidaRecord>- Parameters:
dataSourceAdapter- The new data source adapter to add. No check is made if this is a duplicate.
-
saveRecordToDatabase
- Specified by:
saveRecordToDatabasein classAggregator<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 ofAiidaRecords that either contains all records or only contains records with aAiidaRecordValue.dataTag()that is in the setallowedCodes. All values must have a timestamp beforepermissionExpirationTime. Additionally, the records are buffered and aggregated by theCronExpressiontransmissionSchedule.- 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
allowedCodesset, a timestamp that is beforepermissionExpirationTimeand that are aggregated by thetransmissionSchedule.
-