Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Rx 1.0 Solves the Problem of Asynchronous Data Access

Rx 1.0 Solves the Problem of Asynchronous Data Access

This item in japanese

Microsoft has released version 1.0 of their Reactive Extensions (Rx) library after two years in incubation. Rx combines event-driven UI with LINQ, concurrency and asynchronous calls.

Rx tries to solve the problem of asynchronously accessing data from an event-based UI. The standard Iterator pattern with its basic interfaces IEnumerable and IEnumerator is not adequate for asynchronous operations, so Rx solved the problem by introducing the Observer pattern, having two main interfaces, IObservable and IObserver. Instead of a client iterating step by step over a data collection, the collection pushes data to the client as a result to an asynchronous call, closing the call’s loop.

This scenario is especially useful in cloud computing, according to Erik Meijer, the leader of the Rx project. Cloud computing involves asynchronous calls due to inherent network latencies, so for a client is much better to ask for data, then continue with other tasks and receive the data when it becomes available. While this problem seems simple to be solved using more standard ways, the power of Rx comes from its embedded support for LINQ and concurrency. So, the user not just gets a piece of data in an asynchronous way, be he can generate asynchronous LINQ queries over collections of data and run them concurrently. Rx deals with concurrency by being built on top of Parallel Extensions (PFX), a managed concurrency library including Parallel LINQ and Task Parallel Library.

After two years being in incubation, Rx has become an official Microsoft product and made its debut as the stable release 1.0 in the Data Developer Center. Developers can program with Rx using C#, VB.NET, C++, F# and JavaScript on all Windows versions since XP and also on Windows Phone 7.

Other resources: Recent InfoQ Interview with Bart De Smet on Reactive Extensions (Rx) for .NET and JavaScript, Rx MSDN Documentation, and Channel 9 Rx Workshop.

Rate this Article