Skip to content

Repository files navigation

DurianRx: Reactive getters, powered by RxJava and ListenableFuture

Maven centralApache 2.0

ChangelogJavadocLive chatJitCI

DurianRx unifies RxJava's Observable with Guava's ListenableFuture. If you happen to be using SWT as a widget toolkit, then you'll want to look at DurianSwt as well.

Observable<SomeType> observable = someObservable();
ListenableFuture<SomeType> future = someFuture();
Rx.subscribe(observable, val -> doSomething(val));
Rx.subscribe(future, val -> doSomething(val));

It also provides reactive getters, a simple abstraction for piping data which allows access via T get() or Observable<T> asObservable().

RxBox<Point> mousePos = RxBox.of(newPoint(0, 0));
this.addMouseListener(e -> mousePos.set(newPoint(e.x, e.y)));
RectanglehotSpot = newRectangle(0, 0, 10, 10)
RxGetter<Boolean> isMouseOver = mousePos.map(hotSpot::contains);

Debugging an error which involves lots of callbacks can be difficult. To make this easier, DurianRx includes a tracing capability, which makes this task easier.

// anytime an error is thrown in an Rx callback, the stack trace of the error// will be wrapped by the stack trace of the original subscriptionDurianPlugins.register(RxTracingPolicy.class, newLogSubscriptionTrace()).

DurianRx's only requirements are durian-base, durian-collect, durian-concurrent, and RxJava.

Acknowledgements

About

Reactive getters, powered by RxJava and ListenableFuture

Resources

Contributing

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages