I need to setup a batch job that monitor an SQL table regularly (let’s say every minute) and check if there is data to process. If there is then it should call a script to process the data. Before calling the processing script, it also needs to check if the same process has been happening. If the same process is currently going on then it stops, otherwise just process the data.
In LAMPP environment, I would just create a PHP script to do the processing, setup a cron job to call the script and set the cron job to run every minute.
What’s the best approach to do this in .NET environment? Thank you.
Create a console application, then schedule it using Windows Task Scheduler.
Alternatively, create a Windows Service that runs continually, and either use a timer to run a handler at an interval, or use a
SqlDependencyto run your handler whenever the table changes.