The current options designed.
Options1: Created class Monitorig it has Method1 which call the webservice dynamically on regular interval say 10 Min. And stores the status(Fail/Success) data to DB.
In a for loop I'm creating a new instance of monitoring class every time and a new Thread.
Example.
Expand|Select|Wrap|Line Numbers
- foreach(int i in idlist)
- {
- Monitoring monObj = new Monitoring();
- Thread workerT = new Thread(monObj.MonitorWebService);
- workerT.Start(i);
- }
which does calling of the given webservice at a given interval as 1 min or 10 min etc. To process this in a regular inverval I'm using EventWaitHandle .WaitOne(T1 * 1000, false) instead of Thread.Sleep(). Here T1 can be 1 min or 1 or 5 hours.
Oprion 2:
in the for loop open a new appdomain with new Name and open a new thread as given below.
Expand|Select|Wrap|Line Numbers
- foreach(int i in idlist)
- {
- string appDNname = WSMonitor + i.ToString();
- AppDomain WMSObj = AppDomain.CreateDomain(appDNname);
- Type t= typeof(Monitoring);
- Monitoring monWSObj = (Monitoring) WMSObj.CreateInstanceAndUnwrap(Assembly.GetExecutingAssembly().FullName, t.FullName);
- Thread WorkerT = new Thread(monWSObj.MonitorWebService);
- WorkerT.Start(i);
- }
Which is the best/better approach? Do we have any better solution. A Quick Help is highly appreciated.
I’m in desperate need of help. Please respond.