tags:

views:

173

answers:

3

Hello All

I have this problem domain where I need to able to run a background process that would:

  • Run a filter to get an obj collection (time consuming operation)
  • Pass the obj coll through a set of rules...maybe thru a rule interface
  • Be able to expose any changes that the rules caused to any interested listeners.

Each filter may have many rules and there can be more than one filter.

Would would be the practical way to approach this? I'm thinking:

  • Have a WCF app hosted in a Windows Service that would expose callback for rule changes
  • Let the service do the grunt work of running filter->rules. Will this need to be a separate threaded work ?

Any thoughts or references to existing frameworks, design patterns, etc. are welcome.

thanks Sunit

A: 

You have a couple options, the two most obvious are either the client calls a method that starts the job and polls the server for status, or, setup a callback.

Either way the job should be run on a seperate thread so it doesn't block the service.

If you go with the poll for status route, put the actual result in the returning status. If you go with the callback, use the WSDualHttpBinding and setup a callback. This looks a little scary to setup but it's really not that bad.

I'll let someone else chime in for actual patterns or frameworks, I'm just not sure. Also, checkout MSMQ, this might be another viable solution.

Joshua Belden
Most likely Callback since client will only listen to start/stop any process. Thanks for the comments.
Sunit
Typo...I meant not stop/start anything.
Sunit
A: 

You could use WWF to take care of the rules. You should be able to host WWF as a service.

yuben
+1  A: 

If your background process needs to be instantly (24/7/365) accessible from remote machines, the Windows service makes a lot of sense to me. Assuming you are familiar with C#, it is trivial to create a Windows service. You can follow the step-by-step here. Once you've got the Windows service going, it's easy to host the WCF service by creating the System.ServiceModle.ServiceHost instance in the OnStart callback of the Windows service. As far as WCF patterns and good practices, I'll refer you to Juval Lowy's website, IDesign.net. The site has a lot of free WCF-related downloads just by providing your email address.

Matt Davis
Thanks for the link. I'm using a win service and background worker for filter->rules operation. Since clients will be asking for rules results, I'm thinking of storing this in a file db like sqlite.
Sunit