BT

New Early adopter or innovator? InfoQ has been working on some new features for you. Learn more

Netflix Brings Reactive Extensions to Java

| by Jonathan Allen on Feb 06, 2013. Estimated reading time: 1 minute |

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.

Rate this Article

Adoption Stage
Style

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

Login to InfoQ to interact with what matters most to you.


Recover your password...

Follow

Follow your favorite topics and editors

Quick overview of most important highlights in the industry and on the site.

Like

More signal, less noise

Build your own feed by choosing topics you want to read about and editors you want to hear from.

Notifications

Stay up-to-date

Set up your notifications and don't miss out on content that matters to you

BT