public class SseEventSourceImpl extends Object implements SseEventSource
| Modifier and Type | Class and Description |
|---|---|
static class |
SseEventSourceImpl.SourceBuilder |
SseEventSource.Builder| Modifier and Type | Field and Description |
|---|---|
static long |
RECONNECT_DEFAULT |
| Constructor and Description |
|---|
SseEventSourceImpl(WebTarget target) |
SseEventSourceImpl(WebTarget target,
boolean open) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
close(long timeout,
TimeUnit unit)
Close this event source and wait for the internal event processing task to complete
for up to the specified amount of wait time.
|
boolean |
isOpen()
Check if this event source instance has already been
opened. |
void |
open()
Open the connection to the supplied SSE underlying
web target and start processing incoming
events. |
void |
open(String lastEventId) |
void |
open(String lastEventId,
String verb,
Entity<?> entity,
MediaType... mediaTypes) |
void |
register(Consumer<InboundSseEvent> onEvent)
Register a
InboundSseEvent consumer. |
void |
register(Consumer<InboundSseEvent> onEvent,
Consumer<Throwable> onError)
Register
InboundSseEvent and Throwable consumers. |
void |
register(Consumer<InboundSseEvent> onEvent,
Consumer<Throwable> onError,
Runnable onComplete)
Register
InboundSseEvent and Throwable consumers and onComplete callback. |
void |
setAlwasyReconnect(boolean always)
Deprecated.
|
void |
setAlwaysReconnect(boolean always) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclose, targetpublic static final long RECONNECT_DEFAULT
public SseEventSourceImpl(WebTarget target)
public SseEventSourceImpl(WebTarget target, boolean open)
public void open()
SseEventSourceweb target and start processing incoming
events.open in interface SseEventSourcepublic void open(String lastEventId)
public boolean isOpen()
SseEventSourceopened.isOpen in interface SseEventSourcetrue if this event source is open, false otherwise.public void register(Consumer<InboundSseEvent> onEvent)
SseEventSourceInboundSseEvent consumer.
Given consumer is invoked once per each received event.
register in interface SseEventSourceonEvent - event consumer.public void register(Consumer<InboundSseEvent> onEvent, Consumer<Throwable> onError)
SseEventSourceInboundSseEvent and Throwable consumers.
Event consumer is invoked once per each received event, Throwable consumer is invoked invoked upon a
unrecoverable error encountered by a SseEventSource.
register in interface SseEventSourceonEvent - event consumer.onError - error consumer.public void register(Consumer<InboundSseEvent> onEvent, Consumer<Throwable> onError, Runnable onComplete)
SseEventSourceInboundSseEvent 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 when there are no
further events to be received.
register in interface SseEventSourceonEvent - event consumer.onError - error consumer.onComplete - onComplete handler.public boolean close(long timeout,
TimeUnit unit)
SseEventSourceThe 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.
close in interface SseEventSourcetimeout - the maximum time to wait.unit - the time unit of the timeout argument.true if this executor terminated and false if the timeout elapsed
before termination or the termination was interrupted.@Deprecated public void setAlwasyReconnect(boolean always)
public void setAlwaysReconnect(boolean always)
Copyright © 2019 JBoss by Red Hat. All rights reserved.