Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
I have an application(a windows service) which listens to an incoming port and does some stuff and inserts a record in the DB and returns a byte stream to a socket. I need another service which polls the DB all the time and checks the flags in the record(last inserted record) and if a condition is met a specific task is performed by the service. I need advice regarding how to architect such kind of application.
Posted
Comments
Suvabrata Roy 31-Dec-12 1:31am    
Few querys :

1. Return some byte stream (why need to return some stream)
2. How frequently a service consumer will call service (as you predict)
3. How frequently data would insert at you DB (as you predict)
4. How many concurrent users are their in both way (Put and Get)
Gordon Beeming 31-Dec-12 4:18am    
You said that the polling service would look at the last inserted record, if you polling the service might not catch each record, are you aware of this. I'd suggest that if you need to capture each record add logic into your initial service that will do th polling services logic with each record after inserting it.

Instead of developing and deploying another service, in your current service you can add an timer.
Using the timer elapsed event you can poll the database on the periodic basis. You can start the timer on start and resume of the service and stop the timer on pause or stopping the service.
In the elapsed event, you can read the data from the database and perform the tasks that you need.
 
Share this answer
 
You're just going to have a timer, and make a DB call to see if the condition is met. I'm not sure what you're looking for here. If you're doing inserts in to the DB, I would consider if it's possible to notice the change in your app, and not poll the DB constantly ( which is expensive ).
 
Share this answer
 
I think the timer elapsed event should do the trick.

Thanks for the quick advice.
 
Share this answer
 

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