1

There is very little documentation (that I found) on how the distributed RedisEvents work in ServiceStack.

The documentation says:

One limitation the default MemoryServerEvents implementation has is being limited for use within a single App Server where all client connections are maintained. This is no longer a limitation with the new Redis ServerEvents back-end which utilizes a distributed redis-server back-end to provide a scale-out option capable of serving fan-out/load-balanced App Servers. If you’re familiar with SignalR, this is akin to SignalR’s scaleout with Redis back-end.

It also says how to add the plug-in, but then there is nothing else on how events are distributed, how you post a distributed event and how you handle what node to react to it and post to channel that will reach the correct end-client.

Am I missing something or is there almost no documentation on this?

Cave Johnson
  • 6,499
  • 5
  • 38
  • 57
Ted
  • 19,727
  • 35
  • 96
  • 154

1 Answers1

0

The documentation for RedisServerEvents is at: http://docs.servicestack.net/redis-server-events

There is no difference in API between using an In Memory or Redis Server Events backend which works transparently behind the IServerEvents API. The only difference is in registration where you need to register RedisServerEvents with your configured IRedisClientsManager:

var redisHost = AppSettings.GetString("RedisHost");
if (redisHost != null)
{
    container.Register<IRedisClientsManager>(
        new RedisManagerPool(redisHost));

    container.Register<IServerEvents>(c => 
        new RedisServerEvents(c.Resolve<IRedisClientsManager>()));

    container.Resolve<IServerEvents>().Start();
}

This replaces the default Memory IServerEvents with the RedisServerEvents implementation which sends API calls over Redis Pub/Sub to notify all App Servers configured with the same RedisServerEvents configuration who will send the Server Event to the connected clients on their local /event-stream.

mythz
  • 141,670
  • 29
  • 246
  • 390
  • I have read that page but it doesn't explain very much. Maybe a lot of things are assumed, I don't know. A client is connected to one and only one app server, right? So if a backend service decides something has happened, the correct app server needs to know and send it out. Do all the app servers get the event and... Only one of them has a connection to the client? – Ted Mar 10 '18 at 08:39
  • @Ted Right, all App Servers receives the event via Redis Pub/Sub and if the Server Event was only for a single user or subscription only the App Server that holds the SSE connection will send the Event to the target subscription. Ultimately the same behaviour as Memory ServerEvents where only the targeted subscriptions will receive the event. – mythz Mar 10 '18 at 13:17