public static class SseEventSourceImpl.SourceBuilder extends SseEventSource.Builder
JAXRS_DEFAULT_SSE_BUILDER_PROPERTY
Constructor and Description |
---|
SourceBuilder() |
Modifier and Type | Method and Description |
---|---|
SseEventSource |
build()
Build new SSE event source pointing at a SSE streaming
web target . |
SseEventSource.Builder |
executor(ScheduledExecutorService executor) |
SseEventSource.Builder |
named(String name) |
SseEventSource.Builder |
reconnectingEvery(long delay,
TimeUnit unit)
Set the initial reconnect delay to be used by the event source.
|
SseEventSource.Builder |
target(WebTarget target) |
public SseEventSource.Builder named(String name)
public SseEventSource build()
SseEventSource.Builder
web target
.
The returned event source is ready, but not connected
to 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 SseEventSource.open()
method instead.
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
.
build
in class SseEventSource.Builder
SseEventSource.open()
public SseEventSource.Builder target(WebTarget target)
target
in class SseEventSource.Builder
public SseEventSource.Builder reconnectingEvery(long delay, TimeUnit unit)
SseEventSource.Builder
Note that this value may be later overridden by the SSE endpoint using either a retry
SSE event field
or HTTP 503 + "Retry-After" mechanism as described
in the SseEventSource
javadoc.
reconnectingEvery
in class SseEventSource.Builder
delay
- the default time to wait before attempting to recover from a connection loss.unit
- time unit of the reconnect delay parameter.public SseEventSource.Builder executor(ScheduledExecutorService executor)
Copyright © 2018 JBoss by Red Hat. All rights reserved.