Click here to Skip to main content
15,921,577 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a web application through which client can put jobs in the job queue.

Now I want to write a code which will reside on the server and keep on running all the time and keep on checking whether there is any pending job in the job queue table, if it is there then start a thread for each job and perform that job.

My question to you all experts is that, what are possible ways to do above task?

~Amol
Posted

You can create a scheduled task. Have a look here http://publib.boulder.ibm.com/tividd/td/BSM/SC32-9084-00/en_US/HTML/bsmd62.htm[^]

Good luck!
 
Share this answer
 
v2
Comments
Amol_27101982, India 14-Dec-11 7:33am    
Thanks for your answer, but apart from executing commands I need to perform other tasks which involves some business logic like start/stop threads.
E.F. Nijboer 14-Dec-11 14:27pm    
You can create a TaskSchedule:
http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.management.smo.agent.jobschedule.aspx
I don't know exactly what you mean by starting and stopping threads but it might be something less suitable to implement as a sqlserver job. Why would you want to start and stop the threads yourself? Wouldn't it render the sqlserver scheduler useless?. Because that would normally run the job(s) as scheduled for you.
Write a Windows service that can get job info from the database, and then run the jobs on the specified schedules. Of course, you didn't describe the nature of the "jobs", so it's impossible to be more specific with suggestions.
 
Share this answer
 
Comments
Amol_27101982, India 14-Dec-11 7:35am    
Thanks for your answer, I thought of this way but is there any another approach that we can follow?
#realJSOP 14-Dec-11 8:18am    
You asked for possible ways to do what you want, and have been provided with two possible ways. And THEN, you down-voted both of the answers. I'm sure there are a couple of other ways youcan accomplish what you want, but the method I described is the way *I* would do it. I'm certainly not the end-all/be-all of programming talent, but I *have* been programming for over 30 years, and based on that experience, I recommended the best course of action as I see it. That's all I have for you.
Amol_27101982, India 14-Dec-11 8:39am    
I completely respect your answer John and please don’t misunderstand me …
Only the thing that I am expecting is to know other possible ways…

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900