Server broadcaster can be used to manage multiple server sinks. It enables sending events to all
registered event outputs and provides facility to effectively handle exceptions and closures of individual registered
event outputs.
Instance of this interface is thread safe, meaning that it can be shared and its method invoked from different threads without causing inconsistent internal state.
| Modifier and Type | Method and Description |
|---|---|
| public CompletionStage | Returns: completion stage that completes when the event has been broadcast to all registered event sinks.SSE event to be published. event)Publish an SSE event to all registered |
| public void | close()
Redeclares java. Close the broadcaster and all registered |
| public void | close(boolean
Boolean value that controls closing of registered cascading)SseEventSink instances.Close the broadcaster and release any resources associated with it. |
| public void | onClose(Consumer<SseEventSink>
consumer taking single parameter, a onClose)SseEventSink, which was closed.Register a listener, which will be called when this SseBroadcaster closes a given event |
| public void | onError(BiConsumer<SseEventSink, Throwable>
bi-consumer, taking two parameters: onError)SseEventSink, which is the source of the error and the
actual Throwable instance.Register a listener, which will be called when an exception is thrown by a given |
| public void | register(SseEventSink
to be registered. sseEventSink)Register provided |
| broadcast | back to summary |
|---|---|
| public CompletionStage Publish an SSE event to all registered
| |
| close | back to summary |
|---|---|
| public void close() Redeclares java. Close the broadcaster and all registered
Subsequent calls have no effect and are ignored. Once the
| |
| close | back to summary |
|---|---|
| public void close(boolean cascading) Close the broadcaster and release any resources associated with it. The closing of registered
Subsequent calls have no effect and are ignored. Once the
| |
| onClose | back to summary |
|---|---|
| public void onClose(Consumer<SseEventSink> onClose) Register a listener, which will be called when this SseBroadcaster closes a given event
This operation is potentially slow, especially if large number of listeners get registered in the broadcaster. The
| |
| onError | back to summary |
|---|---|
| public void onError(BiConsumer<SseEventSink, Throwable> onError) Register a listener, which will be called when an exception is thrown by a given
This operation is potentially slow, especially if large number of listeners get registered in the broadcaster. The
| |
| register | back to summary |
|---|---|
| public void register(SseEventSink sseEventSink) Register provided
| |