This project has moved. For the latest updates, please go here.

[en] Using RX with Zyan?

Topics: Technical Support
Sep 10, 2011 at 2:59 PM

Hi !

Have you seen this:


        RemotingConfiguration.RegisterWellKnownServiceType(typeof(ProcessInfo), "ProcessInfo", WellKnownObjectMode.Singleton);


IProcessInfo pi = (IProcessInfo) Activator.GetObject(typeof(IProcessInfo), "ipc://RemotingServerDemo/ProcessInfo");
    pi.ProcessNameCalled.Subscribe( x => { Console.WriteLine("alert:ProcessName called!"); } );    //Event here
    Console.WriteLine(pi.GetProcessName());                            //Causes event on server

I think, this is a really very hand usage-pattern. This sample was

There was no download, but I "scrpaed it" into a VS and it runs fine.

I am just woule like to hear, what you mean.


Sep 12, 2011 at 6:31 PM

Hello mabra,

Zyan has already built-in support for delegates and events; Even without Reactive Extensions.
Please have a look a the following documentation page:

For better scalability I would suggest to use delegates instead of events, because events fired synchronously. That means, that the next client isn´t called before the event handling of the current client is finished.

The following discussion thread shows a fully functional delegate example (This is the recommoneded way for implementing notification with Zyan):

But if you like RX, why not. It should work with Zyan too (but I´ve not tested, yet).
Please post any issues with RX (if you have some; I hope you have not) in the Zyan issue tracker.


Sep 15, 2011 at 7:57 PM

Hi Rainbird !

Thanks for the pointers and an extra thanks showing this difference of events and delegates !

Although I am using events a lot, I am hezitating sometimes, because I know, that the event generating thread is doing all the work,
and this may not be a short task [like the pool expects]. I am not sure, that delegates will be invoked asynchrounsly all the time? Cannot
really belive this [may be my lack of knowledge].

Regarding RX:Why I came [a bit] to it, is the usage pattern. Just subscribe! The observer provides usually all you need:
OnNext, OnCompleted, OnError. BTW:In the mentioned sample, the event class must not derive from MarshalByRefObject!
Very nice [As mentioned:I hacked their demo into a VS solution {you may mail me for it via my codeplex profile}, you could look into it].

Thanks anyway, I'll look onto the mentioned samples!


Sep 19, 2011 at 7:37 PM

Hello mabra,

> I am not sure, that delegates will be invoked asynchronously all the time?

No, they not invoked asynchronously by default. But you can invoke them asynchronously, if you want.
The main problem of events in a distributed environment is that the event firing thread waits for every event client notified.
Event clients are notified in the order they registered for the event.

> BTW:In the mentioned sample, the event class must not derive from MarshalByRefObject!

In Zyan you never have to derive from MarshalByRefObject.