Free online Rx Book RRS feed

  • General discussion

  • I would like to announce that the book "Introduction To Rx" is now available. It is a free book, detailing the broad feature set of the Rx framework. The content is available online at www.IntroToRx.com. You can also get a copy for offline reading in .mobi format (e.g. for Kindle readers) on the site.

    I believe there is a gap in the market between the various blog posts that introduce Rx, posts that tackle a small section of Rx, the videos on Channel 9 and the existing book that is on the market. This book aims to take all users of Rx, beginners and experts alike, and walk them through the library and the thinking behind it. It will guide you to a better understanding of how and when to use each of the parts of the library. I hope that even veterans of Rx will learn some things along the way!

    I am happy to get feedback (both positive and negative/constructive) as replies to this post.

    I hope it helps the Rx community.


    Lee Campbell (Author)

    Lee Campbell http://LeeCampbell.blogspot.com

    Tuesday, June 19, 2012 9:06 AM

All replies

  • Nice work Lee!  Been looking forward to this being released.
    Tuesday, June 19, 2012 10:02 AM
  • Really nice, Lee - already passing out references to this to my team members.

    Will be very interested to see how much it improves their get-up-to-speed time.

    Wednesday, June 20, 2012 9:19 AM
  • Thanks Lee! I loved your original blog posts on the subject.

    Could you produce a pdf of this book as well? We're working in a private lan, so it'll be an easier medium for me to distribute.

    Omer Mor

    Thursday, June 21, 2012 7:03 PM
  • Hi Lee

    I'm currently working on a team with Matt Barrett and he introduced me to your http://www.introtorx.com/ site, and it's great (thanks)! I was wondering if it would be easy for you to make an epub version of your book available, as I don't use a kindle but would love to read it on the go.


    Friday, June 22, 2012 3:50 PM
  • I wouldn't put "easy" in any sentence relating to writing this book ;-)

    If that is a format that people want then I will look into it.  Initial investigation looks promising.

    I was also considering producing just a standard old PDF and word docx formats. I have some final touches to apply from my editor this weekend and then I can focus on getting it into those formats.

    Thanks for your interest.


    Lee Campbell http://LeeCampbell.blogspot.com

    Friday, June 22, 2012 11:12 PM
  • Great job Lee - very useful for both my own reference and pointing others to!

    When's v2.0 due? :)


    Monday, June 25, 2012 11:43 AM
  • >When's v2.0 due? :)

    I will solve a couple of the formatting problems we have been having with Kindle (it is like the bad old day of Div vs Layer tags trying to generate decent MOBI formats), I will get it published up on to Amazon. Then I will have a crack at getting it to other formats (see Omer Mor and RikoEksteen's requests).

    After that I will pick it all up again and get V2 done. Hopefully (but with a 1% chance) I will get something out before v2 is official. I assume the big things that people want to see in the v2 is async/await support? I also want to include a section on IQbservable in the next edition. Is there anything else people are looking for?

    Lee Campbell http://LeeCampbell.blogspot.com

    Monday, June 25, 2012 1:47 PM
  • Kindle version available now on Amazon for less than the price of a bad coffee.

    Search "Introduction to Rx" on your region's amazon site.

    Lee Campbell http://LeeCampbell.blogspot.com

    Monday, July 2, 2012 3:14 PM
  • Awesome job Lee. From one author to another, I know how much this is a labor of love. Now I feel less compelled to write this one myself ;-) I gave my $.99 plus a quick review at http://www.thinqlinq.com/Post.aspx/Title/Reactive-Extensions-books. Hope that helps.

    http://www.ThinqLinq.com http://www.LinqInAction.net - "LINQ In Action", The book is now available. Don't wait for the movie

    Friday, July 6, 2012 7:45 PM
  • On page http://www.introtorx.com/Content/v1.0.10621.0/05_Filtering.html

    could it be that you copy paste the SkipLast example for what was ment to be the takelast?

    Reading the book atm. Well done and much needed :)

    Sunday, July 8, 2012 10:50 PM
  • Thanks for the link Jim.

    A labor of love it is, I figured trying to sell a book for $10-30, I might sell 100, and after royalty I might get $70?! Not a lot of money, so make it free (or cheap) so people will actually read it. :-)

    It seems that Jessie/Paul's book plus my one now fill the 101 gap. My next task will be to create the Advanced one that also covers

    • Cookbook style samples e.g. How to : Read a stream, Aggregate Prices, Consume tweets, Integrate with WPF/MVVM etc....
    • New features of v2.0
    • IQbservable
    • async/await
    • RxJS
    • StreamInsight

    I am not sure if the wife is too keen for me to start another one though!

    Lee Campbell http://LeeCampbell.blogspot.com

    Monday, July 9, 2012 12:02 PM
  • Thanks Tom.

    Looks like you are spot on. That does look like a cut and paste Fail. I will update it asap.

    Lee Campbell http://LeeCampbell.blogspot.com

    Monday, July 9, 2012 12:03 PM
  • Hi Lee,

    Just wanted to drop a note to say that your IntroToRx.com website is great!  I have Jesse & Paul's book and had been doing a bit of Rx previously, but reading your site "cover to cover" was a great way to solidify the concepts and gradually build a deeper level of understanding.

    Thanks for the resource! :)

    Cheers, Ian

    Ian Yates Technical Manager Medical IT Pty Ltd PO Box 501, Carina QLD 4152 Australia Web: www.medicalit.com.au

    Wednesday, July 25, 2012 2:15 AM
  • Thanks for taking the time to say thanks guys. Makes it all worth while.

    I am starting to collect ideas for the cookbook now. I hope there are some helpful gems that come out of that too, but don't hold your breath, this is a long way away.

    Lee Campbell http://LeeCampbell.blogspot.com

    Wednesday, July 25, 2012 8:20 AM
  • Awesome stuff Lee, v.cool making it free too :)
    Tuesday, July 31, 2012 7:38 PM
  • Lee, this book has been a real go-to reference for me as I've been brushing up my Rx skills. Thanks for writing it, and sharing it so freely.

    James World

    Wednesday, August 8, 2012 9:26 AM
  • Amazing work! Thanks so much for writing this and making the Kindle edition available. It is by far the best "introduction" to Rx that I have found, and I learned a lot despite having used Rx extensively in a previous project. I will be recommending it to all of my coworkers and sincerely hope that its availability will speed the adoption of this incredible framework. 
    Tuesday, August 28, 2012 6:05 PM
  • Hey man, 

    Just want to say thank you very much for sharing such a great book with us!

    I am really enjoying reading it.



    Friday, March 8, 2013 5:43 PM
  • Enjoying the book so far; thanks for writing it and making it available!

    I saw a couple of typos at http://www.introtorx.com/Content/v1.0.10621.0/04_CreatingObservableSequences.html: the first name of both Jeffrey Richter and Jeffrey van Gogh is "Jeffrey", not "Jeffery" (http://www.wintellect.com/cs/blogs/jeffreyr/http://blogs.msdn.com/b/jeffva/).

    Monday, April 1, 2013 7:41 AM
  • Thanks for your hard work on this -- it's a very helpful and well written book.


    Friday, June 28, 2013 10:57 PM
  • Lee, I can't begin to tell you how helpful this book has been to me.  I have been greedily poring over every word for the last few days and I feel like a kid in a candy store.  Perhaps someday if you cross paths with any of us at a conference or whatnot, we'll have a chance to repay the debt in the one true universal currency (beer!)  And pass thanks along to your wife for allowing you the time...mine only lets me off the leash periodically so I fully appreciate the household capital you must have expended already.


    Wednesday, July 31, 2013 1:44 AM
  • It is really great to hear that people are still getting a lot of use from the site/book. It is a totally "pay-it-forward" kind of thing. As mentioned in the Foreword, other contributions like the Git book (and Git for that matter), Joe's Threading papers, Q for Mortals etc... make my life so much easier.

    Currently I am pouring all my spare time into another pet-project (full of Rx code). Once that is done(ish), I would love to turn my head to another Rx book. I think a Cookbook, or a .NET v2 version, or perhaps a Polyglot one for Scala, Java, Ruby, Javascript, C++ and .NET! In a lovely dream world, I would be able to collaborate with Bart, Erik, Paul, Matt, Joe etc...

    Lee Campbell http://LeeCampbell.blogspot.com

    Thursday, August 1, 2013 1:23 PM
  • I've been spending most of my nights playing around with Rx. I must admit, for me, there was a steep learning curve until this book came around which has turned it in to a gentle slope.

    Thanks Lee!

    The universe is mostly hydrogen and ignorance.

    Friday, August 2, 2013 12:22 PM
  • Hi Lee,

    your book is great and it really helped me to understand many aspects of Rx. Many thanks for your work.

    Nevertheless just now one thing confused me. In the chapter "Creating your own Iterator" you construct extension method ToObservable for Stream and it's quite complex. I was wondering, if there isn't a better way and I came with this solution:

    public static IObservable<byte> ToObservable(this Stream stream, int bufferSize)
        var buffer = new byte[bufferSize];
        return Observable
            .Defer(() => stream.ReadAsync(buffer, 0, buffer.Length).ToObservable())
            .TakeWhile(bytesRead => bytesRead != 0)
            .SelectMany(bytesRead => buffer.Take(bytesRead));

    I know that this solution doesn't use iterator and so it's not good example for your chapter. But maybe at least there can be notice that the provided example is artificially complicated to show desired functionality.


    Wednesday, August 28, 2013 3:41 PM
  • Thanks for the feedback Václav. The book was written for Version 1 of Rx running against .NET 4.0. Just as the book was released, so too was V2.0 of Rx and the Async features. At a similar time .NET 4.5 was also released. You are correct that there is most likely a better way, and your implementation above looks very good indeed (I haven't run it however).

    I have another side project consuming my time at the moment, but I very much would like to do an update to the book one day for V2 and .NET 4.5. I even think that Scala and JavaScript implementations would warrant a mention as they seem to fit very well (not so much for Java, sorry NetFlix).

    In the mean time, I have two repos that you can feel free to contribute to 


    This is the SVN repo I used when writing the book. It is now a GitHub repo. I will one day set up to the build server and get auto deployments running, but the site itself was a very manual process :-(


    This is a collection of recipes that I am trying to collate. The idea is that the Book can date ( as your comment proves) a wiki style repo like this, should be a touch easier to contribute to and keep up to date.

    Lee Campbell http://LeeCampbell.blogspot.com

    Wednesday, August 28, 2013 5:09 PM
  • I'm new to Rx, and have found the book quite useful. However, I have a problem combining SubscribeOn and cancellation support.

    In an UI application, I have a request for data that may take a long time. Obviously, I do not want to block the UI thread, and I have successfully accomplished this with a method like this:

    public IObservable<string> GetData()
    	return Observable.Create<string>(observer =>
    		var cancel = new CancellationDisposable();
    		NewThreadScheduler.Default.Schedule(() => GetDataLongRunning(observer, cancel.Token));
    		return cancel;
    private void GetDataLongRunning(IObserver<string> observer, CancellationToken cancellationToken)
    	for (int i = 0; i < 100; i++)
    		if (cancellationToken.IsCancellationRequested)

    Notice the NewThreadScheduler, which ensures the UI is not blocked. This means the UI layer can get the observable and use it like this (using Buffer to avoid updating the UI for every single record, and ObserveOn to ensure it happens on the UI thread):

    _subscription = GetData().Buffer(TimeSpan.FromSeconds(1), 10).ObserveOn(SynchronizationContext.Current.Subscribe( items => AddRecordsToControl(items), ex => HandleError(ex), () => IndicateCompleted());

    And if the UI layer disposes _subscription, the operation is cancelled. This all works fine.

    Then I read the following in part 4 of the book:

    When writing UI applications, the SubscribeOn/ObserveOn pair is very useful for two reasons:

    1. you do not want to block the UI thread
    2. but you do need to update UI objects on the UI thread.

    Since this is exactly what I'm doing (and I like the idea of the caller being able to decide what thread it should execute on), I got rid of the NewThreadScheduler in GetData (and just called GetDataLongRunning instead), and then added a SubscribeOn(NewThreadScheduler.Default) in the UI's request.

    However, although it basically works as before, it does change the behaviour so cancellation no longer works. Disposing the subscription means the UI no longer received data, but the GetDataLongRunning continues to run until it is finished. The reason is, that it is no longer just GetDataLongRunning that is running in another thread, but the entire subscribe delagate provided to Observable.Create. I.e. the CancellationDisposable object is not returned before the entire operation is finished, and therefore not tied to the disposable returned by Subscribe call.

    Now, I can of course just go back to my original code (optionally supplying the IScheduler to use from the caller as a parameter to GetData), but then I don't understand the usefulness of SubscribeOn in this scenario. Is there another way to support cancellation when using SubscribeOn?

    Thursday, October 31, 2013 9:16 AM
  • There is a mistake on www.introtorx.com. In the section "Other connectable observables" you wrote "The Connect method is not the only method that returns IConnectableObservable<T> instances", but you probably meant "The Publish method is not..."

    Anyway, great book!

    • Edited by spacy51 Thursday, January 30, 2014 4:58 PM
    Thursday, January 30, 2014 4:57 PM
  • Sorry about the late reply. I think all you need to do here is chagne your code to the following

    public IObservable<string> GetData()
    	return Observable.Create<string>(observer =>
    		var cancel = new BooleanDisposable();
    		var scheduledTask = NewThreadScheduler.Default.Schedule(() => GetDataLongRunning(observer, cancel));
    		return new CompositeDisposable(scheduledTask, cancel);
    private void GetDataLongRunning(IObserver<string> observer, BooleanDisposable cancelRequest)
    	for (int i = 0; i < 100; i++)
    		if (cancelRequest.IsDisposed)

    It would be great to see what your real code is doing. This sample code is not really in the spirit of Rx and could be further improved. eg. we could just simply do this

    public IObservable<string> GetData2()
    	return Observable.Interval(TimeSpan.FromMilliseconds(100))

    Lee Campbell http://LeeCampbell.blogspot.com

    Tuesday, May 20, 2014 2:02 PM
  • PDF is available here

    Thursday, February 26, 2015 10:34 PM
  • Something that has been bugging me for a while now:

    The online book doesn't look quite right in Firefox. The reason seems to be the 'float: left' on the Logo.

    Friday, May 1, 2015 12:28 PM
  • Excellent compilation and content Lee.


    Seems a typo : variable name should be evenNumbers..

    var oddNumbers = Observable.Range(0, 10)

    .Where(i => i % 2 == 0)



    () => Console.WriteLine( "Completed"));

    Overall must have book for a RX developer.

    Sunday, May 3, 2015 10:58 AM
  • Hello

    it seems to me there's a small typo at Section "05 - Filtering - SkipUntil and TakeUntil". Where it says:

    Obviously, the converse is true for TakeWhile. When the secondary sequence produces a value, then the TakeWhile operator will complete the output sequence.

    probably "TakeWhile" should be instead "TakeUntil". Then again, I'm not sure if the meaning of the whole sentence remains valid or what.



    & thanks for the good read!

    Monday, May 18, 2015 9:12 AM
  • Hello there

    I'd just like to warn about a typo in a bit of code found here:

    • url: http://www.introtorx.com/content/v1.0.10621.0/16_TestingRx.html#AdvancedFeatures
    • section: CreateHotObservable

    In the second (longer) code sample there must have been some swap with "<" and ">". E.g.:

    new Recorded>Notification>long<<

    Apparently that happens for every occurrence in that code block, as the same thing is found in the final foreach.

    Kind regards

    Monday, July 13, 2015 9:46 AM
  • It seems that the mobi download link is broken http://www.introtorx.com/Content/v1.0.10621.0/Content/v1.0.10621.0/IntroToRx.mobi



    Friday, July 17, 2015 8:35 PM
  • Hi Lee,  thanks, very good tutorial. I'd like to ask when it'll be update to version 2.xx.



    Wednesday, September 9, 2015 9:14 AM