Interface SseSource

All Superinterfaces:
AutoCloseable

@Experimental @NoImplement @MinMuleVersion("4.10.0") public interface SseSource extends AutoCloseable
A consumer of server-sent events.
Since:
0.12.0
  • Field Details

  • Method Details

    • open

      void open()
      Opens the source. It will send the initiator request or just start parsing the response's payload depending on the configured SseSourceConfigurer.
    • getReadyState

      int getReadyState()
      Returns:
      the readyState.
    • register

      void register(String eventName, SseListener listener)
      Registers a listener for a specific event name (a.k.a. topic, a.k.a. type).
      Parameters:
      eventName - The event name that the listener will handle.
      listener - The event handler.
    • register

      void register(SseListener listener)
      Registers a fallback listener for all the events that aren't handled by any listener registered with register(String, SseListener).
      Parameters:
      listener - The event handler.
    • doOnConnectionFailure

      void doOnConnectionFailure(Consumer<SseFailureContext> onConnectionFailure)
      Registers a callback to be called when an error occurs.
      Parameters:
      onConnectionFailure - to be called when an error occurs.
    • close

      void close()
      Aborts reconnection if it's scheduled, and closes the connection if established.
      Specified by:
      close in interface AutoCloseable