Quantcast
Channel: #Zyan Communication Framework
Viewing all articles
Browse latest Browse all 665

New Post: [en] Windows Service

$
0
0
Hello Mark,

1) Yes, you can. I've just created an example for you:
https://gist.github.com/yallie/d9cab09680c98e8a224b9a302f581a8c

It boils down to this:
// Service classpublicclass ServiceExample : ServiceBase, IServiceExample
{
    private ZyanComponentHost Host { get; set; }

    protectedoverridevoid OnStart(string[] args)
    {
        // start the server
        Host = new ZyanComponentHost(name, port);
        Host.RegisterComponent<IServiceExample, ServiceExample>(this);
        base.OnStart(args);
    }

    protectedoverridevoid OnStop()
    {
        // stop the server
        Host.Dispose();
        base.OnStop();
    }

    // implement your shared interface here
}
But I'd suggest to use the TopShelf library instead of ServiceBase.
To my experience, it's a lot easier to set up and maintain (no installutil required, etc.)
Here is an example Zyan+TopShelf service: https://gist.github.com/yallie/7a3a4a16ce8f4b9e74da

2) Yes, surely.

3) Yes, that's possible. To receive events from another server, C1 and C2 should
connect to server S2 and subscribe to its events manually, just as they did to server S1.
Also, you can have your S1 and S2 servers to subscribe to each other's events and
rebroadcast them to their clients (this feature isn't included out-of-the-box, but it's easy
to implement).

4) No, Zyan isn't an message queue, it's an RPC. It supports pub-sub pattern,
but it doesn't have persistent queues, guaranteed event delivery and such.

5) Yes, ZyanConnection class has Disconnected event (it works if heartbeat is enabled).
Disconnected event allows to retry or cancel the connection. If retrying succeeded,
the Reconnected event is raised.

Hope that helps,
Alex

Viewing all articles
Browse latest Browse all 665

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>