views:

61

answers:

1

We are debating to correct way to setup a notification service. This serivce will be called by various apps and the service will need to return relevant data back.

My feeling is you just create a Web service that the intranet portal (or anything) could access by sending the user ID and in return getting any information (User 425 report is 90 days due, Application has been rejects.. etc..) We have multiple intranet apps as well as the portal (Lets call them App A, B, and C).

Another person here said we need to use MSMQ.. so I did some research and as far as I can tell the point of MSMQ is for when you have a user the performs some sort of request that is long and cannot be run synchronously .. If these calls take 0.02 seconds.. What is a advantage of MSMQ? All I am doing is sending back a message...

So which makes more sense?

Bonus: App A, B, and C all have thier own Business Logic for determining what messages to send back to the main portal app... So I can.

  1. Have the notification web service contain all the logic for Apps A B and C? Problem there is now I am invovled in understanding how app A B and C work so I can have the WS post back the appropriate message..

  2. Use MEF/IoC and as part of the build process I get a MEF .DLL that implements a certain interface. So My notification program jsut goes to the various apps and says GIVE ME YOUR BIZ LOGIC DLL.... so once I have all the DLLs and know the interface I can just loop through thme and get the data I need... That way its up to the devs of A, B, and C that are expoerts of thier domain to implement this message passing interface.

Help. (I barely understand MEF so I could be way off there)

+1  A: 

I think part of the issue here is that there is some confusion about exactly what the role that MSMQ would be playing in this. Basically you have two methods of doing these notifications:

  1. Have a series of web services which can be queried to get the required notifications (a pull model lets say)
  2. Have the applications publish status changes that occur during the course of them doing their job, some of which can be picked up by the notification service and then processed (a push model)

Now, in the case of option 2, you can use something like NServiceBus to set up a Publish/Subscribe messaging system which would allow applications to publish the important events in the system, and a notification service to subscribe to the messages that need to generate notifications. It just so happens that NServiceBus uses MSMQ under the covers as the default transport, so in that case MSMQ would come into the picture, but only as an implementation detail.

In the case of option 1, you could implement that in any number of ways, including WCF web services.

Personally, I find the Pub/Sub model to be the most scalable and flexible of the options, plus the documentation for the project is above par, which is nice.

ckramer
MY initial idea was version 1. It is more simple and to the point. Someone logs on and it fires off a request to the notification system to bring back any notifications.Option 2 seems to me good if these apps are creating work for my notification service that would be long running...So assuming the notification service can start and finish whatever its doing in under 0.05 seconds.. I don't see the point of having any queue
punkouter
The queue gives you some added reliability, so if there is some critical failure (windows update) during the web service call, instead of getting lost in the ether, it is actually written to the queue, so when things either fail over, or start back up again, the waiting message is processed. It really depends on how you look at your architecture, are you asking services for their status or are your services alerting other services about what is happening.
ckramer
If I created a windows service that updates a 'Notifications' table and creates entries when it discovers notifications that need to be sent..Then I imagine other apps can just call a web service that looksup that nable and returns back the collection of notifications..I don't see how pub/sub helps any here or else I don't get it... The internal apps are not 'Subscribed in any way except they have code that calls the notification web service.. The apps arent publishing any status changes.. the NOTIFICATION web service has the logic and the DB for that.
punkouter
In other words, you've kind of implemented MSMQ on top of a database table :-)
Udi Dahan