Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Rx defines a grammar that specifically prohibits OnNext from overlapping <em>from the standpoint of any given Observer</em>. It is possible that <em>multiple</em> subscribers to a stream can be called in parallel (but that depends on the implementer of the Rx operator).</p> <p>Here we have two subscribers that handle OnNext at different rates from the same stream:</p> <pre><code>void Main() { var stream = Observable.Interval(TimeSpan.FromSeconds(1)); var sub1 = stream.Subscribe(x =&gt; { Console.WriteLine("Sub1 handler start: " + Thread.CurrentThread.ManagedThreadId); Thread.Sleep(4000); Console.WriteLine("Sub1 handler end"); }); var sub2 = stream.Subscribe(x =&gt; { Console.WriteLine("Sub2 handler start: " + Thread.CurrentThread.ManagedThreadId); Thread.Sleep(2000); Console.WriteLine("Sub2 handler end"); }); Console.ReadLine(); } </code></pre> <p>Here is the output, see how Sub2 is racing ahead of Sub1, and each is on their own thread.</p> <pre><code>Sub2 handler start: 18 Sub1 handler start: 12 Sub2 handler end Sub2 handler start: 18 Sub2 handler end Sub2 handler start: 18 Sub1 handler end Sub1 handler start: 12 Sub2 handler end Sub2 handler start: 18 Sub2 handler end Sub1 handler end Sub2 handler start: 18 Sub1 handler start: 12 </code></pre> <p>Note that there's nothing to say that each subscription get's it's own thread - that's down to how the scheduler and operator are implemented. As long as they conform to the Rx grammar of <strong>OnNext* (OnError | OnCompleted)</strong> anything goes.</p> <p>For your particular scenario, I would look into <a href="http://msdn.microsoft.com/en-us/library/dd460688.aspx" rel="nofollow">PLINQ</a> / TPL - it feels like a better fit than Rx.</p> <p>By the way, Lee Campbell's <a href="http://www.introtorx.com" rel="nofollow">www.introtorx.com</a> is a good resource if you are just starting out.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload