Use Project Reactor and Vaadin together
Veactor is a set of helpers to use Project Reactor and Vaadin together.
The main functionality is focused on updating parts of a Vaadin UI when new elements are published to a Flux
or Mono
. This is done using an appropriate subscribe
method in the Veactor
class. Each of those methods requires a component instance that is used to control the life cycle of the subscription - the subscription is started when the component is attached (happens immediately if it's already attached when subscribe
is called) and the subscription is closed when the component is detached again.
@Push
@Route("hello")
public class HelloWorldView extends VerticalLayout {
public HelloWorldView() {
Flux<Long> flux = Flux.interval(Duration.ofSeconds(1)).take(10);
Span message = new Span("Waiting for updates...");
Veactor.subscribe(this, flux, value -> message.setText("Received value " + value));
add(message);
}
}
Install
Framework Support
Vaadin platform 10+
Browser Independent
Install with
Release notes - Version 1.0.1
Initial working version