You can easily do bi-directional communication using Rx, but it's involving 
two Subjects, which are both Observables and Observers, or any flavor 
thereof Subjects whether Replay, Async, Behavior, or Buffered or Controlled 
(for backpressure coming soon).

var subject1 = new Rx.Subject();
var subject2 = new Rx.Subject();

var sub1 = subject1.subscribe(subject2);
var sub2 = subject2.subscribe(subject1);

And yes, back to Timothy's point, it is not possible in Rx to have multiple 
people calling onNext at a single time as we have locks around that kind of 
behavior, so there is no chance for overlapping onNext calls, and have the 
strict grammar enforced of 0-N onNext calls with an optional onError or 
onCompleted but not both.  Once the onError or onCompleted calls have been 
fired, no onNext values can be fired.  You can get around that behavior in 
a number of ways with retry, catch, or even onErrorResumeNext so instead of 
terminating the entire sequence, you can go to another sequence or retry 
the current one.

Matt

>
> Having used both I would agree that CSP is more general and when you 
> need to do custom logic it tends to be easier, IME, than Rx. Another key 
> difference is that Rx is only about one way communication within a 
> single subscription.  Once you need to have bi-directional communication 
> CSP is a better tool for the job. 
>
> -Ben 
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to