Inter service communciation

Just a service design question here. Just a little out of touch on what else is available these days.

Lets say I had 3 services, and they each call each others API’s, as well as being called by other clients.
Now I need one of those services to notify one/more of the other services about a change in the state of one of the resources it manages.

What are the options today (for what seems to me like a sub/sub architecture) to help fulfil this?

My go to since we are already hosted in Azure, was the Azure Service Bus, but wanted to play the field a bit first before locking in. What else is out there that is well supported by ServiceStack?

I will consider an incremental approach (to get an easy win), rather than a final solution silver bullet from the get go.

My preferred choice for sending Pub/Sub notifications to multiple app servers is to use Redis Pub/Sub.

Server Events with a Redis back-end offers a layer above that which has nice functionality thanks to the C# Server Events Client.

These notifications are transient, so if an AppServer is down or restarting it would lose notifications, for sending persistent pub/sub notifications I’d use Rabbit MQ, although you’d need to use the underlying RabbitMQ.Client as the RabbitMQ Messaging support in ServiceStack just does OneWay/Request+Reply.

Thanks, I can get started with this for now

If using ServerEvents, what mechanisms are there to restrict the subscriptions to known subscribers?

The scenario is that our services are all public domain (and their API’s are protected by oAuth), so I would not want just anyone (public) to subscribe and receive server events published by any of these services. Those subscribers would have to be authorized subscribers (i.e. only services that we trust).

How does that work with ServerEvents?

There’s a LimitToAuthenticatedUsers so server event subscriptions are only limited to Authenticated users, e.g:

Plugins.Add(new ServerEventsFeature {
    LimitToAuthenticatedUsers = true
});

For any further custom restrictions you can use the OnCreated hook to apply any additional custom restriction logic, e.g:

Plugins.Add(new ServerEventsFeature {
    OnCreated = (subscription, req) => { 
        if (!MyAllowIp(req.UserHostAddress)) {
            req.Response.StatusCode = (int)HttpStatusCode.Forbidden;
            req.Response.EndRequest();
        }
    }
});