Class StreamerManager

java.lang.Object
energy.eddie.aiida.streamers.StreamerManager
All Implemented Interfaces:
AutoCloseable

@Component public class StreamerManager extends Object implements AutoCloseable
The StreamerManager manages the lifecycle of AiidaStreamer. Other components should rely on the StreamerManager for creating or stopping streamers.
  • Constructor Details

  • Method Details

    • createNewStreamer

      public void createNewStreamer(Permission permission) throws IllegalArgumentException, org.eclipse.paho.mqttv5.common.MqttException
      Creates a new AiidaStreamer for the specified permission and stores it internally. The created streamer will receive any matching AiidaRecord as requested by the data need of the permission.
      Parameters:
      permission - Permission for which an AiidaStreamer should be created.
      Throws:
      IllegalArgumentException - If an AiidaStreamer for the passed permission has already been created.
      org.eclipse.paho.mqttv5.common.MqttException
    • terminationRequestsFlux

      public reactor.core.publisher.Flux<UUID> terminationRequestsFlux()
      Returns a Flux on which the ID of a permission is published when the EP requests a termination for this permission. The Flux allows only one subscriber and buffers, ensuring no values get lost.
      Returns:
      Flux of permissionIDs for which the EP requested termination.
    • stopStreamer

      public void stopStreamer(AiidaConnectionStatusMessageDto message)
      Sends the passed status message in a blocking manner and then terminally stops the streamer.
      Parameters:
      message - Message to send before stopping the streamer. The status should be one of PermissionStatus.TERMINATED, PermissionStatus.REVOKED or PermissionStatus.FULFILLED.
    • close

      public void close()
      Closes all streamers to allow for an orderly shutdown. Note that this blocks until all streamers have finished closing, which may be indefinitely in the current implementation.
      Specified by:
      close in interface AutoCloseable