.Net messaging pub / sub pattern

So, I have a .NET application that runs on NancyFx (should be agnostic for the platform). I have a requirement that I need to send a notification when a specific event (subscription) occurs. A notification will implement this interface:

public interface INotification
{
    public void Notify();
}

For this, for example, there will be many different implementations. Email, Pushbullet, Pushover, etc.

What I'm struggling with is how to implement this so that all implementations INotificationexecute Notify()when there is a subscription.

Can someone point me in the right direction.

I do not want to use any external queues, since the application will run on users' computers.

Thus, the application is self-service, the client and server are located on the user's computer, and he does not talk to the outside world, everything is internal.

+4
source share
3 answers

Forgive me for a second, I just want to make sure I'm right. You did not write what the exact problem is, so I assume you are stuck somewhere in some basics. I will also ignore NancyFX, I don’t know this, I assume that if he supports this business, you will find it in the documents.

, - , 3 :
(a) , , , "", Ping!
() , , , , "", Ping!
(c) , //etc, . ,

"publish-subscribe", , (C).

, , / . API , , , . . API, , "", API- .

, API - . Notify(string xmlizedOrJsonizedData), Notify(string infotype, datetime, data) NotifyEmal(...) NotifyBullet(...) ... - api , .

, , . , . , NancyFx . , api , , api, .. .

.

, . , . , 10000 . . , , -. , . . NAT, , Client- > to- > Server, . - . :80 , :80 , , , api :23122, , , /.. upnp/etc.

, .. , - , , google PublishSubscribe, .

"WebSockets". (B), . . - / / apis/interfaces websocket, .

, Nancy SignalR, .

+3

, , , , - . , , , WPF/MVVM, MVVM .

, MVVM, - .

0

.NET /. NCache

,

public void OnApplicationEvent(object notifId, object data)
{
  ...
} 
_cache.CustomEvent += new CustomEventCallback(this.OnApplicationEvent);

,

_cache.RaiseCustomEvent("NotificationID", DateTime.Now);
0

All Articles