Class SseEventSourceImpl

    • Constructor Detail

      • SseEventSourceImpl

        public SseEventSourceImpl​(WebTarget target)
      • SseEventSourceImpl

        public SseEventSourceImpl​(WebTarget target,
                                  boolean open)
    • Method Detail

      • open

        public void open​(String lastEventId)
      • isOpen

        public boolean isOpen()
        Description copied from interface: SseEventSource
        Check if this event source instance has already been opened.
        Specified by:
        isOpen in interface SseEventSource
        Returns:
        true if this event source is open, false otherwise.
      • register

        public void register​(Consumer<InboundSseEvent> onEvent,
                             Consumer<Throwable> onError,
                             Runnable onComplete)
        Description copied from interface: SseEventSource
        Register InboundSseEvent and Throwable consumers and onComplete callback.

        Event consumer is invoked once per each received event, Throwable consumer is invoked invoked upon a unrecoverable error encountered by a SseEventSource, onComplete callback is invoked after a successful connection and when there are no further events to be received. Note that the onComplete callback will not be invoked if the onError callback has been invoked.

        Specified by:
        register in interface SseEventSource
        Parameters:
        onEvent - event consumer.
        onError - error consumer.
        onComplete - onComplete handler.
      • close

        public boolean close​(long timeout,
                             TimeUnit unit)
        Description copied from interface: SseEventSource
        Close this event source and wait for the internal event processing task to complete for up to the specified amount of wait time.

        The method blocks until the event processing task has completed execution after a shutdown request, or until the timeout occurs, or the current thread is interrupted, whichever happens first.

        In case the waiting for the event processing task has been interrupted, this method restores the interrupt flag on the thread before returning false.

        Specified by:
        close in interface SseEventSource
        Parameters:
        timeout - the maximum time to wait.
        unit - the time unit of the timeout argument.
        Returns:
        true if this executor terminated and false if the timeout elapsed before termination or the termination was interrupted.