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
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceContract to process event loop messages, possibly translating an event into some other type of event or events.static enumType of an events handled by anEventLoop. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispatch(org.reactivestreams.Publisher<? extends org.springframework.messaging.Message<?>> messages) DispatchMessages into anEventLoopfrom aPublisher.voiddispatch(org.springframework.messaging.Message<?> message) Dispatch aMessageinto anEventLoop.reactor.core.publisher.Flux<? extends org.springframework.messaging.Message<?>>events()Return aFluxofMessageevents.<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 safeMouseEvents.voidonDestroy(reactor.core.Disposable disposable) RegisterDisposableto 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 aFluxofMessageevents. When subscribed events will be received until disposed orEventLoopterminates.- 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 safeMouseEvents.- 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) DispatchMessages into anEventLoopfrom aPublisher. Usually type is eitherMonoorFlux.- Parameters:
messages- the messages to dispatch
-
dispatch
void dispatch(org.springframework.messaging.Message<?> message) Dispatch aMessageinto anEventLoop.- Parameters:
message- the message to dispatch
-
onDestroy
void onDestroy(reactor.core.Disposable disposable) RegisterDisposableto get disposed when event loop terminates.- Parameters:
disposable- a disposable to dispose
-