Hey Demis,
I’m trying to implement the RedisPubSubServer and RedisServerEvents and I’m missing something somewhere.
The OnMessage Event on RedisPubSubServer is being fired and I’m calling NotifyChannel on the RedisServerEvents object (using the same, correct channel name throughout)…but for some reason the OnMessage delegate on my ServerEventsClient is not being called…
I was wondering if there was a simple, uncluttered working example that I could take a look at to understand how the pieces all fit together?
The Chat example is pretty lean since it fits in 1 .cs and supports both InMemory and Redis Server Events by just adding an entry for “RedisHost” in your AppSettings:
https://github.com/ServiceStackApps/Chat/blob/master/src/Chat/Global.asax.cs#L46
There’s also a ServiceStack.Gap/ILMerged version of Chat which is what was used to demo RedisServerEvents, you can get it at:
https://github.com/ServiceStack/ServiceStack/blob/master/release-notes.md#cross-platform-memory-and-redis-serverevent-enabled-chatexe
Also both InMemory and RedisServerEvents share the same integration tests: https://github.com/ServiceStack/ServiceStack/blob/b9eb34eb80ff64fa1171d2f7f…d/tests/ServiceStack.WebHost.Endpoints.Tests/ServerEventTests.cs#L169-L189
Ryan Britton:
Thanks for the quick response, Demis.
so…does the initialisation for RedisServerEvents wire up the RedisPubSubServer internally?
and do I just need to call RedisServerEvents.NotifyChannel and not worry about the internals of how the message gets from the Redis queue to the client?
RedisServerEvents does use RedisPubServer internally but this is an internal impl detail you don’t have to worry about.
Right you can just use the IServerEvents
API and not care if it uses InMemory or RedisServerEvents, also the client wont be able to tell which is used.
Ryan Britton:
ok great - got it working
thanks for the help, Demis.