I’ve to create a windows service in .NET that polls a db table for any new records. If there is any new record then it should do some processing. I’m aware I can do that easily by timer, is there any better way to handle this scenario?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you are using SQl Server you could use Notification Services. You can write a query that shows retrieves some data and when the data changes an event will be sent to your application.
So instead of polling the database constantly you will have push based solution.
Here you can find some documentation
[Edit]
I’m working on the design of a windows service myself that will do regular synchronization between some external systems. That will happen once a day on a regular time interval. We don’t need to be notified of individual changes so currently I’m not planning on using notification services. But in your case if updates can occur on any moment and you need to work with them immediately I think a push based approach is nicer.