- Enclosing interface:
public abstract static class SseEventSource.Builder extends ObjectJAX-RS
Event source builder provides methods that let you conveniently configure and subsequently build a new
SseEventSourceinstance. You can obtain a new event source builder instance using a static
SseEventSource es = SseEventSource.target(endpoint) .reconnectingEvery(5, SECONDS) .build(); es.register(System.out::println); es.open();
Constructors Modifier Constructor Description
Builder()Allows custom implementations to extend the SSE event source builder class.
All Methods Instance Methods Abstract Methods Modifier and Type Method Description
build()Build new SSE event source pointing at a SSE streaming
reconnectingEvery(long delay, TimeUnit unit)Set the initial reconnect delay to be used by the event source.
protected abstract SseEventSource.Builder
public abstract SseEventSource.Builder reconnectingEvery(long delay, TimeUnit unit)Set the initial reconnect delay to be used by the event source.
delay- the default time to wait before attempting to recover from a connection loss.
unit- time unit of the reconnect delay parameter.
- updated event source builder instance.
public abstract SseEventSource build()Build new SSE event source pointing at a SSE streaming
The returned event source is ready, but not
connectedto the SSE endpoint. It is expected that you will manually invoke its
SseEventSource.open()method once you are ready to start receiving SSE events. In case you want to build an event source instance that is already connected to the SSE endpoint, use the event source builder
Once the event source is open, the incoming events are processed by the event source in an asynchronous task that runs in an internal single-threaded
scheduled executor service.
- new event source instance, ready to be connected to the SSE endpoint.
- See Also: