views:

494

answers:

2

I wish to develop an application in VB.NET to provide to following functionality and hope you can give me some pointers on which direction to take.

I need some kind of “server” type component which sits in the background monitoring request from users and performing various task. (this component can be install locally or centrally) The users submit an instruction to the “server” to perform a certain task at a designated date and time. (or perform the task straight away)

The “server” would perform the task at the desired date and time and inform the user the result of the task.

I have thought of using a central database to which the user writes the instructions. The “server” could read from the database to obtain the instructions, and write the result back to the database.

I want a fast reaction to the instructions, so the “server” must poll the database every few seconds; I fear this may be detrimental to performance. Also how do I get the server to perform the task at the desired time?

Again checking all outstanding tasks against the current time is not very efficient, so I thought about utilising the Windows Scheduler, but I am not sure of the best way of integrating this functionality.

I would be grateful for any ideas, pointers or suggestions.

+1  A: 

We have a similar system where we work, utilising a webservice to accept requests, run them when required, and notify callers with the results if necessary.

In our case the callers were other applications and not people.

The web service consisted of the following methods: (rough version, not exact)

  • int AddJob(string jobType, string input, datetime startTime) // schedules job and sets timer to call StartJobs when needed, and then returns job id
  • void GetResults(int jobId, out string status, out string output) // gets results (status="queued / running / completed / failed")
  • void StartJobs() //called via a timer as needed to kick off scheduled jobs

We also built in checks to limit how many jobs of could run simultaneously, and whether they could retry if they failed, and emails admins if any jobs fail the last attempt.

Our version is much more comprehensive than this, with the jobs actually being webservices themselves, supporting simultaneous running, built-in workflow so jobs can wait on others, but maybe it will give you some ideas. It's not a trivial project, but was fun to implement!

Will
Thanks for the reply. web services are not available to me, but I think the logic is very similar to my needs. Thanks
Tim
+2  A: 

Have you looked at quartz.net? It's a scheduling framework which might be useful to you.

Ed Harper
Looks good. I will download and read all about it. Thanks for the pointer.
Tim