Reputation: 2600
I got a database of subscriptions, I want to run a for every subscriptions from one time to another every x minute.
But every subscription has its own from and to time + what every x minutes its should run the function.
Its can be many subscriptions running the same time.
Maybe its should looks like a scheduled task that starting at one specific time and runs every x minute to one specific time.
I hope I describe what I want to do right, my English is not the best.
Do anyone has any idea how I building the application todo this?
Upvotes: 0
Views: 528
Reputation: 19956
You are maybe describing just what Quartz.NET can do for you. Check it out, it might be worth spending some time.
Upvotes: 1
Reputation: 3408
So you should write some kind of scheduler. It will take tasks from the queue and execute them... You can create a scheduler in such a way that every task for example will run in a separate thread and it would significantly improve performance!
Upvotes: 0
Reputation: 498904
You have a couple of choices here:
You mentioned scheduled tasks, which might be another option, but that will require you to automate the setting up of new tasks as well as the actual tasks to run. Both of these are easier to do with the options I have outlined above.
Upvotes: 5
Reputation: 12226
I would recommend you to use System.Threading.Timer
for that. To schedule a job, do the following:
new Timer(_ => DoTheJob()).Change(your_interval_in_milliseconds, Timeout.Infinite);
then when job is done, schedule next run using the same code. That would prevent running 2 instances of the same job simultaneously. Please let me know if that does not answer your question appropriately.
Upvotes: 2