Class ValidatedHistoricalDataStream

java.lang.Object
energy.eddie.regionconnector.de.eta.providers.ValidatedHistoricalDataStream
All Implemented Interfaces:
AutoCloseable

@Component public class ValidatedHistoricalDataStream extends Object implements 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 Details

    • ValidatedHistoricalDataStream

      public ValidatedHistoricalDataStream(Outbox outbox)
  • Method Details

    • validatedHistoricalData

      public reactor.core.publisher.Flux<IdentifiableValidatedHistoricalData> validatedHistoricalData()
      Get the flux of validated historical data. Subscribers (like JsonRawDataProvider) use this.
      Returns:
      the flux of identifiable validated historical data
    • publish

      public void publish(DePermissionRequest permissionRequest, EtaPlusMeteredData data)
      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 known Granularity, it passes through (the MDA may have a temporary data gap).
      If either check fails, a PermissionProcessStatus.UNFULFILLABLE event is committed and no data is published to the stream.
      Parameters:
      permissionRequest - the permission request the data belongs to
      data - the validated historical data from ETA Plus
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable