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
    • publishRetransmission

      public void publishRetransmission(DePermissionRequest permissionRequest, EtaPlusMeteredData data)
      Publishes retransmitted validated historical data to the outbound stream without mutating permission state.

      Unlike publish(DePermissionRequest, EtaPlusMeteredData), this method neither updates the latest-meter-reading watermark nor emits any status event. A retransmission re-delivers data the eligible party already received for a window in the past, so it must not regress the fulfillment watermark — which would otherwise trigger redundant re-polling of the whole range — nor change the permission's status (e.g. to PermissionProcessStatus.UNFULFILLABLE). The data still reaches the outbound connectors through the same stream consumed by the raw-data and CIM providers.

      Parameters:
      permissionRequest - the permission request the data belongs to
      data - the validated historical data fetched for the retransmission window
    • close

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