Interface AiidaStreamer

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
MqttStreamer

public interface AiidaStreamer extends AutoCloseable
Streams the records of a permission to the streaming target (EP) and receives PermissionCommands from it. Implementations should initialize and prepare any necessary resources on creation, but only open connections and stream data after connect() was called.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Unsubscribe from any Flux and free any used resources in this method.
    void
    Sends a AiidaConnectionStatusMessageDto with the passed status before closing this streamer for good.
    void
    Open required connections to the streaming target (EP) in this method, not beforehand.
    boolean
    Returns whether this streamer is currently connected to the streaming target (EP).
    void
    publishSchemaPayload(UUID permissionId, AiidaSchema schema, String payload)
    Publishes a payload of the provided schema to the permission of the provided id.
    void
    setTransmissionEnabled(boolean enabled)
    Enables or disables data transmission for this streamer.
    void
    updateRecordFlux(reactor.core.publisher.Flux<AiidaRecord> recordFlux)
    Replaces the record flux this streamer is subscribed to and resubscribes.
  • Method Details

    • connect

      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.
    • isConnected

      boolean isConnected()
      Returns whether this streamer is currently connected to the streaming target (EP).
    • close

      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

      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:
    • setTransmissionEnabled

      void setTransmissionEnabled(boolean enabled)
      Enables or disables data transmission for this streamer. While disabled, records are not published to the EP.
    • updateRecordFlux

      void updateRecordFlux(reactor.core.publisher.Flux<AiidaRecord> recordFlux)
      Replaces the record flux this streamer is subscribed to and resubscribes. Used to apply a new transmission schedule, which re-aggregates the upstream records on a different cadence.
    • publishSchemaPayload

      void publishSchemaPayload(UUID permissionId, AiidaSchema schema, String payload)
      Publishes a payload of the provided schema to the permission of the provided id.