BT

Netflix Brings Reactive Extensions to Java

by Jonathan Allen on Feb 06, 2013 |

Netflix has created and open sourced a Java implementation of MS Open Tech’s Reactive Extensions. But to say RxJava is just for Java would be misleading, as it has been designed to be used from other JVM languages as well. “The first languages supported (beyond Java itself) are Groovy, Clojure, Scala and JRuby.”

Netflix created RxJava to simplify server-side concurrency. Their goal is to allow the client to invoke a single "heavy" client request that is executed in parallel on the server. Ben Christensen and Jafar Husain explain,

Server-side concurrency is needed to effectively reduce network chattiness. Without concurrent execution on the server, a single "heavy" client request might not be much better than many "light" requests because each network request from a device naturally executes in parallel with other network requests. If the server-side execution of a collapsed "heavy" request does not achieve a similar level of parallel execution it may be slower than the multiple "light" requests even accounting for saved network latency.

According to Ben and Jafar, the functional reactive is superior to the futures and callbacks because “Functional reactive offers efficient execution and composition by providing a collection of operators capable of filtering, selecting, transforming, combining and composing Observable's”.

By making the service layer API return an Observable<T> for all methods, developers are isolated from the implementation of those methods. The methods may be invoked asynchronously today, but return synchronously tomorrow. The service method is also free to choose between blocking and non-blocking I/O, the former being used when resources are constrained.

RxJava supports “Java 5 (to include Android support) and higher with an eventual goal to target a build for Java 8 with its lambda support.” Like the original Rx, Netflix’s RxJava is offered under the Apache License. You can get RxJava from github.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT