Click here to Skip to main content
13,559,281 members
Rate this:
Please Sign up or sign in to 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 30-Dec-12 19:18pm
SuvabrataRoy 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-Za 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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

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 ).
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I think the timer elapsed event should do the trick.

Thanks for the quick advice.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web03 | 2.8.180515.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100