Class EventProcessor
java.lang.Object
org.glassfish.jersey.media.sse.internal.EventProcessor
- All Implemented Interfaces:
Runnable
,EventListener
Private event processor task responsible for connecting to the SSE stream and processing
incoming SSE events as well as handling any connection issues.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
EventProcessor
builder.static interface
Used to signal that theEventProcessor
reached terminal stage.static enum
Event processor state, which is shared with the owner (to be able to control bootstrap and shutdown). -
Method Summary
Modifier and TypeMethodDescriptionvoid
Await the initial contact with the SSE endpoint.static EventProcessor.Builder
builder
(WebTarget target, AtomicReference<EventProcessor.State> state, ClientExecutor clientExecutor, EventListener eventListener, EventProcessor.ShutdownHandler shutdownHandler) Create new Event processor builder.void
onEvent
(InboundEvent event) Called by the event source when an inbound event is received.void
run()
-
Method Details
-
builder
public static EventProcessor.Builder builder(WebTarget target, AtomicReference<EventProcessor.State> state, ClientExecutor clientExecutor, EventListener eventListener, EventProcessor.ShutdownHandler shutdownHandler) Create new Event processor builder.- Parameters:
target
- web target to be used to call remote resource.state
- state shared with the owner of event processor instance.clientExecutor
- executor service used for consuming events and scheduling reconnects.eventListener
- event listener.shutdownHandler
- shutdown callback.- Returns:
- new
EventProcessor.Builder
instance.
-
run
public void run() -
onEvent
Called by the event source when an inbound event is received. This listener aggregator method is responsible for invokingEventSource.onEvent(InboundEvent)
method on the owning event source as well as for notifying all registeredevent listeners
.- Specified by:
onEvent
in interfaceEventListener
- Parameters:
event
- incominginbound event
.
-
awaitFirstContact
public void awaitFirstContact()Await the initial contact with the SSE endpoint.
-