Interface EventLoop
- All Known Implementing Classes:
DefaultEventLoop
public interface EventLoop
EventLoop
is a central place where all eventing will be orchestrated
for a lifecycle of a component. Orchestration is usually needed around timings
of redraws and and component state updates.
Generic message type is a Spring Message
and it's up to an EventLoop
implementation how those are processed.-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Contract to process event loop messages, possibly translating an event into some other type of event or events.static enum
Type of an events handled by anEventLoop
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispatch
(org.reactivestreams.Publisher<? extends org.springframework.messaging.Message<?>> messages) DispatchMessage
s into anEventLoop
from aPublisher
.void
dispatch
(org.springframework.messaging.Message<?> message) Dispatch aMessage
into anEventLoop
.reactor.core.publisher.Flux<? extends org.springframework.messaging.Message<?>>
events()
Return aFlux
ofMessage
events.<T> reactor.core.publisher.Flux<T>
events
(EventLoop.Type type, Class<T> clazz) Specialisation ofevents()
which returns type safe stream filtered by given eventloop message type and message payload class type.<T> reactor.core.publisher.Flux<T>
events
(EventLoop.Type type, org.springframework.core.ParameterizedTypeReference<T> typeRef) Specialisation ofevents()
which returns type safe stream filtered by given eventloop message type and message payload class type.reactor.core.publisher.Flux<KeyEvent>
reactor.core.publisher.Flux<MouseEvent>
Specialisation ofevents()
which returns type safeMouseEvent
s.void
onDestroy
(reactor.core.Disposable disposable) RegisterDisposable
to get disposed when event loop terminates.reactor.core.publisher.Flux<String>
Specialisation ofevents()
which returns type safe {code signal} events.reactor.core.publisher.Flux<String>
Specialisation ofevents()
which returns type safe {code system} events.<T extends ViewEvent>
reactor.core.publisher.Flux<T>viewEvents
(Class<T> clazz) <T extends ViewEvent>
reactor.core.publisher.Flux<T>viewEvents
(Class<T> clazz, View filterBy) <T extends ViewEvent>
reactor.core.publisher.Flux<T>viewEvents
(org.springframework.core.ParameterizedTypeReference<T> typeRef) <T extends ViewEvent>
reactor.core.publisher.Flux<T>viewEvents
(org.springframework.core.ParameterizedTypeReference<T> typeRef, View filterBy)
-
Method Details
-
events
reactor.core.publisher.Flux<? extends org.springframework.messaging.Message<?>> events()Return aFlux
ofMessage
events. When subscribed events will be received until disposed orEventLoop
terminates.- Returns:
- the events from an event loop
-
keyEvents
reactor.core.publisher.Flux<KeyEvent> keyEvents()- Returns:
- the key events from an event loop
-
mouseEvents
reactor.core.publisher.Flux<MouseEvent> mouseEvents()Specialisation ofevents()
which returns type safeMouseEvent
s.- Returns:
- the mouse events from an event loop
-
systemEvents
reactor.core.publisher.Flux<String> systemEvents()Specialisation ofevents()
which returns type safe {code system} events.- Returns:
- the system events from an event loop
-
signalEvents
reactor.core.publisher.Flux<String> signalEvents()Specialisation ofevents()
which returns type safe {code signal} events.- Returns:
- the signal events from an event loop
-
viewEvents
- Type Parameters:
T
- the type to expect- Parameters:
clazz
- the type class to filter- Returns:
- the filtered events from an event loop
-
viewEvents
<T extends ViewEvent> reactor.core.publisher.Flux<T> viewEvents(org.springframework.core.ParameterizedTypeReference<T> typeRef) - Type Parameters:
T
- the type to expect- Parameters:
typeRef
- the parameterized type to filter- Returns:
- the filtered events from an event loop
-
viewEvents
- Type Parameters:
T
- the type to expect- Parameters:
clazz
- the type class to filterfilterBy
- the view to filter- Returns:
- the filtered events from an event loop
-
viewEvents
<T extends ViewEvent> reactor.core.publisher.Flux<T> viewEvents(org.springframework.core.ParameterizedTypeReference<T> typeRef, View filterBy) - Type Parameters:
T
- the type to expect- Parameters:
typeRef
- the parameterized type to filterfilterBy
- the view to filter- Returns:
- the filtered events from an event loop
-
events
Specialisation ofevents()
which returns type safe stream filtered by given eventloop message type and message payload class type.- Type Parameters:
T
- the type to expect- Parameters:
type
- the eventloop message type to filterclazz
- the type class to filter- Returns:
- the filtered events from an event loop
-
events
<T> reactor.core.publisher.Flux<T> events(EventLoop.Type type, org.springframework.core.ParameterizedTypeReference<T> typeRef) Specialisation ofevents()
which returns type safe stream filtered by given eventloop message type and message payload class type.- Type Parameters:
T
- the type to expect- Parameters:
type
- the eventloop message type to filtertypeRef
- the parameterized type to filter- Returns:
- the filtered events from an event loop
-
dispatch
void dispatch(org.reactivestreams.Publisher<? extends org.springframework.messaging.Message<?>> messages) DispatchMessage
s into anEventLoop
from aPublisher
. Usually type is eitherMono
orFlux
.- Parameters:
messages
- the messages to dispatch
-
dispatch
void dispatch(org.springframework.messaging.Message<?> message) Dispatch aMessage
into anEventLoop
.- Parameters:
message
- the message to dispatch
-
onDestroy
void onDestroy(reactor.core.Disposable disposable) RegisterDisposable
to get disposed when event loop terminates.- Parameters:
disposable
- a disposable to dispose
-