Building highly available windows services with embedded event store


I believe Greg mentions in a talk (don’t remember the talk!) that it would be possible to build highly available window services with embedded event stores…

Is there anything written on the subject?

Yeah just let es do the clustering. Listen for state change eg are you master. Only master does the job, all communication happens through stream. Done :slight_smile:

That's pretty cool.. I assume all clients of the service needs to communicate through streams also which doesn't leave room for request reply communication..

No, you could do whatever you like when you become master, for example open a listening TCP socket or whatever.

Internally when you write to a stream that request will automatically forward etc. this is how many of the internal services work as well (like competing consumers)

Just to be clear, if I see any other state change I should immediately stop processing?

Yes if you become not master you should stop at that point (another server will take over) not this is for a service where you want one node doing the job

At the moment I have three embedded nodes in a cluster up and running. With master election etc… working as expected.
How should I handle inter node communication?
If I append to a stream with an embedded connection within the service that is currently master, should I expect to see that stream being replicated to other nodes?

Yes you just write/read streams everything else is handled

How do I listen for state changes? Is there a stream I should subscribe to?

In embedded there is a message that is raised for you ... its an event
on ClusterVNode.

Ah, so I just += that thing.


You are awesome.

Is there a way to determine who is currently master if a node becomes non-master?

gossip .. we could expose it as the node already does it...

Why do you need it?

Accepting commands over HTTP. Rather than ceasing to respond to requests, I was thinking of redirecting to the master.

this happens automatically in es itself for atom or tcp requests if
you are embedding just put in the request and it will forward

I was thinking of redirecting the client’s command (HTTP POST JSON request) to the master command service, not the ES traffic. I know that ES traffic automatically redirects. I only want one command service processing at a time until/if I setup partitioning.

So there are problems woth external redirect in the general case. The biggest and i think most important for you (without knowing everything about your setup) is do you want addressable nodes or just a load balancer in front?