Class AiidaStreamer

java.lang.Object
energy.eddie.aiida.streamers.AiidaStreamer
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
MqttStreamer

public abstract class AiidaStreamer extends Object implements AutoCloseable
  • Field Details

    • aiidaId

      protected final UUID aiidaId
    • recordFlux

      protected final reactor.core.publisher.Flux<AiidaRecord> recordFlux
    • terminationRequestSink

      protected final reactor.core.publisher.Sinks.One<UUID> terminationRequestSink
  • Constructor Details

    • AiidaStreamer

      protected AiidaStreamer(UUID aiidaId, reactor.core.publisher.Flux<AiidaRecord> recordFlux, reactor.core.publisher.Sinks.One<UUID> terminationRequestSink)
      Create a new AiidaStreamer and sets the Flux for records and status messages that should be sent. The constructor should initialize and prepare any necessary resources but only after connect() was called, connections should be opened and data streamed.
      Parameters:
      recordFlux - Flux, where records that should be sent are available.
      terminationRequestSink - Sink, to which the permissionId will be published when the EP requests a termination.
  • Method Details

    • connect

      public abstract void connect()
      Open required connections to the streaming target (EP) in this method, not beforehand. Subscribe to the Fluxes in this method, to receive records and status messages that shall be sent. Start listening for termination requests from the EP.
    • close

      public abstract void close()
      Unsubscribe from any Flux and free any used resources in this method. May flush all queued messages beforehand.
      Specified by:
      close in interface AutoCloseable
    • closeTerminally

      public abstract void closeTerminally(AiidaConnectionStatusMessageDto statusMessage)
      Sends a AiidaConnectionStatusMessageDto with the passed status before closing this streamer for good. May block until the passed statusMessage is transmitted.
      See Also: