Home  /  Questions  /  Question



50   50
Jul 02, 2013


Is the Observer pattern the correct approach?

I am getting ready to start on a new application and would like some feedback to see if I am heading down the right road. Basically I want to have a messaging system that triggers emails and then workflows around each.

What I am envisioning is the observer pattern potentially and figured many others have probably already done something similar. I have a bunch of point of sale devices and I want to have a series of rules that test the sales and other factors at each store. Example would be if a shift exceeds the dollar amount of free meals for the shift, then I want to trigger an email to the general manager and then also store this off to display in a web application for later.

I envision that this email or rule will have some series of steps that must happen, example the once the GM acknowledges the email, maybe this rule ends. Another rule may petty cash in which case if the paid out value is above some threshold I want the GM to get a message and then have to go and attach a receipt.

Here is where a workflow I believe would be needed, lets say the GM forgets to attach the receipt, I want to notify him again in 5 days. If he forgets twice I want to re-assign the notification to the district manager, etc. Is the observer pattern the appropriate solution or should I look into something like nServiceBus??

Thanks

James