问题描述:

In our system, we have one or more frontend instances running per user. They’re hosted on a number of Citrix servers.

We want to notify users when something happens and ensure that the message reaches each frontend. How do we accomplish this?

The initial though was to use publish/subscribe, but wouldn’t we need a queue per frontend?

Alternatively, can you pass on a message somehow, ensuring that every handler instance on the frontend gets the message?

网友答案:

You are absolutely right that you would need an input queue per client instance if you wanted to use Rebus to actually send the message to the frontend.

I generally advise against using Rebus to communicate directly to clients, though, because it is mostly convenient for things that are more "stable".

The thing is: Clients come and go - that is the nature of a "client". Messaging libraries like Rebus (e.g. NServiceBus, MassTransit, etc.) generally work best when the number of endpoints does not fluctuate too much.

You can still use Rebus to do the coordination on the server, as a helpful tool to implement asynchronous things in a reliable way, but I suggest you use something like SignalR to push notifications that last inch of the way out from the server to the client(s).

SignalR has just what you need, actually, in that it provides a model for you to keep arbitrary groups of clients to whom you can push messages.

相关阅读:
Top