Package energy.eddie.aiida.aggregator
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 Summary
FieldsModifier and TypeFieldDescriptionprotected reactor.core.publisher.Sinks.Many<DataSourceRecord> protected final List<DataSourceAdapter<? extends DataSource>> protected final org.springframework.boot.health.registry.HealthContributorRegistry -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAggregator(Class<T> recordType, 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().voidclose()Closes allDataSourceAdapters and emits a complete signal for all the Flux returned byDataSourceAdapter.start().protected voidhandleCombinedSinkError(Throwable throwable) protected voidhandleError(Throwable throwable, DataSourceAdapter<? extends DataSource> dataSourceAdapter) protected voidpublishRecordToCombinedFlux(T data) voidremoveDataSourceAdapter(DataSourceAdapter<? extends DataSource> dataSourceAdapter) Removes aDataSourceAdapterfrom this aggregator and will close the datasource.protected abstract voidsaveRecordToDatabase(T dataRecord)
-
Field Details
-
dataSourceAdapters
-
healthContributorRegistry
protected final org.springframework.boot.health.registry.HealthContributorRegistry healthContributorRegistry -
combinedRecordSink
-
-
Constructor Details
-
Aggregator
-
-
Method Details
-
addNewDataSourceAdapter
Adds a newDataSourceAdapterto this aggregator and will subscribe to the Flux returned byDataSourceAdapter.start().- Parameters:
dataSourceAdapter- The new data source adapter to add. No check is made if this is a duplicate.
-
removeDataSourceAdapter
Removes aDataSourceAdapterfrom this aggregator and will close the datasource.- Parameters:
dataSourceAdapter- The datasource adapter to remove.
-
close
public void close()Closes allDataSourceAdapters and emits a complete signal for all the Flux returned byDataSourceAdapter.start().- Specified by:
closein interfaceAutoCloseable
-
saveRecordToDatabase
-
publishRecordToCombinedFlux
-
handleCombinedSinkError
-
handleError
protected void handleError(Throwable throwable, DataSourceAdapter<? extends DataSource> dataSourceAdapter)
-