Class ValidatedHistoricalDataStream
java.lang.Object
energy.eddie.regionconnector.de.eta.providers.ValidatedHistoricalDataStream
- All Implemented Interfaces:
AutoCloseable
Central stream for validated historical data from ETA Plus.
This component manages the reactive stream of validated historical data AND
is responsible for tracking the latest meter reading for fulfillment checks.
Before emitting, data need constraints (energy type and granularity) are enforced:
if the received data does not satisfy the constraints stored on the permission request,
the request is marked PermissionProcessStatus.UNFULFILLABLE and no data is published.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidpublish(DePermissionRequest permissionRequest, EtaPlusMeteredData data) Validates data need constraints and, if satisfied, publishes validated historical data to the stream and updates the latest reading state.reactor.core.publisher.Flux<IdentifiableValidatedHistoricalData> Get the flux of validated historical data.
-
Constructor Details
-
Method Details
-
validatedHistoricalData
Get the flux of validated historical data. Subscribers (like JsonRawDataProvider) use this.- Returns:
- the flux of identifiable validated historical data
-
publish
Validates data need constraints and, if satisfied, publishes validated historical data to the stream and updates the latest reading state.When the permission request carries an energy type (VHD data needs), the following checks are applied to the received readings:
- Energy type: the unit of the first reading must correspond to
DePermissionRequest.energyType(). A mismatch means the MDA is serving the wrong commodity (e.g. gas instead of electricity). - Granularity: when at least two readings are present, the interval between
the first two sorted readings must match
DePermissionRequest.granularity(). If the interval cannot be mapped to a knownGranularity, it passes through (the MDA may have a temporary data gap).
PermissionProcessStatus.UNFULFILLABLEevent is committed and no data is published to the stream.- Parameters:
permissionRequest- the permission request the data belongs todata- the validated historical data from ETA Plus
- Energy type: the unit of the first reading must correspond to
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-