Class WicaStreamServerSentEventPublisher

java.lang.Object
ch.psi.wica.services.stream.WicaStreamServerSentEventPublisher

@ThreadSafe public class WicaStreamServerSentEventPublisher extends Object
Provides the functionality to publish a stream of Server-Sent-Events (SSE) to remote web clients.
  • Constructor Details

    • WicaStreamServerSentEventPublisher

      WicaStreamServerSentEventPublisher(WicaStream wicaStream, WicaStreamMetadataCollectorService wicaStreamMetadataCollectorService, WicaStreamMonitoredValueCollectorService wicaStreamMonitoredValueCollectorService, WicaStreamPolledValueCollectorService wicaStreamPolledValueCollectorService, WicaChannelMetadataMapSerializerService wicaChannelMetadataMapSerializerService, WicaChannelValueMapSerializerService wicaChannelValueMapSerializerService)
      Create a new publisher with the capability to create a flux with the specified SSE ID and which uses the specified SSE Builder to transform information dynamically retrieved from the message payload supplied.
      Parameters:
      wicaStream - the stream associated with this publisher.
      wicaStreamMetadataCollectorService - the service which will be used to collect metadata.
      wicaStreamMonitoredValueCollectorService - the service which will be used to collect monitored values.
      wicaStreamPolledValueCollectorService - the service which will be used to collect polled values.
      wicaChannelMetadataMapSerializerService - the service which will be used to serialize channel metadata.
      wicaChannelValueMapSerializerService - the service which will be used to serialize channel values.
  • Method Details

    • getStream

      public WicaStream getStream()
      Returns this publisher's stream.
      Returns:
      the stream
    • getFlux

      reactor.core.publisher.Flux<org.springframework.http.codec.ServerSentEvent<String>> getFlux()
      Returns a reference to this publisher's combined flux.
      Returns:
      the flux.
      Throws:
      IllegalStateException - if the flux has been shutdown.
    • shutdown

      public void shutdown()
      Shuts down this publisher instance.

      This method should only be called once, subsequent attempts to shutdown the flux will result in an IllegalStateException.

      Throws:
      IllegalStateException - if the flux has already been shutdown.