Questions tagged [system.reactive]

System.Reactive refers to the Reactive Extensions for .NET, also known as Rx. Rx provides developers with a reactive programming model over the generic IObservable interface, as opposed to the traditional imperative programming model or the other reactive programming models that rely strictly on .NET Events or specific APIs.

A brief introduction

system.reactive refers to the Reactive Extensions (Rx), a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators. System.Reactive is the root namespace used through the library. Using Rx, developers represent asychronous data streams using LINQ operators, and parameterize the concurrency in the asynchronous data streams using Schedulers. Simply put, Rx = Observables + LINQ + Schedulers.

Whether you are authoring a traditional desktop or web-based application, you have to deal with asynchronous and event-based programming from time to time. Desktop applications have I/O operations and computationally expensive tasks that might take a long time to complete and potentially block other active threads. Furthermore, handling exceptions, cancellation, and synchronization is difficult and error-prone.

Using Rx, you can represent multiple asynchronous data streams (that come from diverse sources, e.g., stock quote, tweets, computer events, web service requests, etc., and subscribe to the event stream using the IObserver<T> interface. The IObservable<T> interface notifies the subscribed IObserver<T> interface whenever an event occurs.

Because observable sequences are data streams, you can query them using standard LINQ query operators implemented by the Observable extension methods. Thus you can filter, project, aggregate, compose and perform time-based operations on multiple events easily by using these standard LINQ operators. In addition, there are a number of other reactive stream specific operators that allow powerful queries to be written. Cancellation, exceptions, and synchronization are also handled gracefully by using the extension methods provided by Rx.

Rx complements and interoperates smoothly with both synchronous data streams (IEnumerable<T>) and single-value asynchronous computations (Task<T>).

Source and further information

The project is actively developed by Microsoft Open Technologies, Inc., in collaboration with a community of open source developers. The source code is hosted on github here.

Additional documentation, video, tutorials and hands-on-labs are available on MSDN, and help and discussions the Rx Forums.

ReactiveX has been ported to many platforms, and information about supported platforms and links to platform specific implementations can be found here.

Related tags

3422 questions
2
votes
2 answers

RxJava: why same transformations are recomputed for each observables branch?

Introduction Consider simple piece of java code. It defines two observables a and b in terms of c which itself is defined using d (a, b, c, d have type Observable): d = Observable.range(1, 10); c = d.map(t -> t + 1); a = c.map(t…
Vasiliy Kevroletin
  • 1,188
  • 13
  • 17
2
votes
2 answers

Does .Net Reactive Extensions Framework (Rx) takes topological order into consideration?

Does the .Net Reactive Extensions Framework propagates the notifications in topological order to minimize the amount of updates? Like Scala Rx does: Does .Net Reactive Extensions (Rx) ta
jeromerg
  • 2,997
  • 2
  • 26
  • 36
2
votes
1 answer

IReactiveBinding doesn't work with IDataErrorInfo

I have a problem using the IDataErrorInfo in combination with IReactiveBinding.Bind(). I hope someone here can help me. I have a ViewModel that is inherited from ReactiveObject and implements the IDataErrorInfo interface. public class…
Rufus Buschart
  • 362
  • 1
  • 13
2
votes
1 answer

Can I use Reactive Extensions for controlling the timing of an instrument test cycle?

Here's the problem I'm trying to solve... I'm writing a program that controls a piece of test equipment. The program polls the instrument via serial interface every second, and gets a string of test data in return. Connection speed is 9600 baud, and…
Tom Bushell
  • 5,865
  • 4
  • 45
  • 60
2
votes
1 answer

Building an RX operator to split one observable of key-value-pairs into multiple observables, one per distinct key

I'm an RX newbie trying to construct something that seems complex to me. Here's the problem: I have a hot observable that is producing key-value pairs, let's say . They're coming in no particular order. The output should be an observable…
tempy
  • 1,567
  • 2
  • 18
  • 28
2
votes
2 answers

Cancel RX.Net Observer's ongoing OnNext methods

As described in my original question (see Correlate interdependent Event Streams with RX.Net) I have an RX.net event stream that shall only call the observer's OnNext method as long as a certain other event is not triggered (basically 'Handle…
2
votes
3 answers

Compose multiple network calls RxJava - Android

Help in composing multiple network calls and accumulate the result in Rxjava. (I am using in an Android application.) State -- List cityList; City - cityId; RestCall 1 Observable stateRequest = restService.getStates(); RestCall…
Mani
  • 767
  • 1
  • 10
  • 20
2
votes
3 answers

Cron Observable Sequence

I would like to create an observable sequence using reactive extensions (RX) and NCrontab. The sequence would differ from something like Observable.Timer() in that the period and due time are not fixed. After reading this article it seems that…
2
votes
1 answer

How to use Rx to monitor a file for changes?

I am using Rx to monitor changes to a file. | window1 | | window2 | | window3 | Time 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 Input M M M M M R Output M M …
Naximus
  • 579
  • 6
  • 18
2
votes
1 answer

Zip or Merge two IObservable sequences where one sequence can fail

I have a requirement that sees the merging of two IObservable sequences but with the potential for one of these sequences to fail without impacting the observer. So taking the example from the Intro to Rx book of a sequence of numbers and characters…
David
  • 1,731
  • 24
  • 37
2
votes
2 answers

Combine/merge an unknown number of observables together as they are created

What I would like to do is: Call a function (DoWork) which as part of it's work will subscribe to multiple hot inputs through multiple Worker classes Before calling the function subscribe to all the updates that DoWork subscribes to Once finished,…
Iain
  • 2,500
  • 1
  • 20
  • 24
2
votes
1 answer

Rx TestScheduler throwing NullReference exception when background thread schedules action

In light of some of the comments, I should make it clear that this question is about why the TestScheduler is throwing a null-reference exception, not how to get the test to pass. An earlier example assumed that interaction with the TPL was the…
NeilMacMullen
  • 3,339
  • 2
  • 20
  • 22
2
votes
2 answers

Reactive extensions: Zip operator but different

This is not real life example (and this code will probably not compile) but I'm trying to make it a little bit simpler than the problem I actually have. Let's say I have collection of images: private void IEnumerable GetImages() { foreach…
Milosz Krajewski
  • 1,160
  • 1
  • 12
  • 19
2
votes
2 answers

With Reactive Extensions (RX), is it possible to shift .Buffer time back by 10 seconds?

I am using Buffer to collect all events over one minute, and present them into a list: this.GetServiceAvailablityRxStream .Buffer(TimeSpan.FromMinutes(1)) .Subscribe( serviceAvailableList => { …
Contango
  • 76,540
  • 58
  • 260
  • 305
2
votes
1 answer

Coordinating multiple IObservables on a single button

I have a button that alternates between play/pause. Rather than flip-flopping a boolean, I want to see if there is a good solution using reactive extensions. Here is a rough estimate of what I was thinking. var whenPlayClicked =…
1 2 3
99
100