Click here to Skip to main content
Rate this: bad
good
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 20:18pm
Comments
Suvabrata Roy at 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)
B1n4ry D1g1t at 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
good
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.
  Permalink  
Rate this: bad
good
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 ).
  Permalink  
Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 269
1 OriginalGriff 180
2 DamithSL 180
3 Peter Leow 125
4 Kornfeld Eliyahu Peter 95
0 OriginalGriff 7,355
1 DamithSL 5,254
2 Sergey Alexandrovich Kryukov 4,942
3 Maciej Los 4,906
4 Kornfeld Eliyahu Peter 4,514


Advertise | Privacy | Mobile
Web02 | 2.8.141223.1 | Last Updated 31 Dec 2012
Copyright © CodeProject, 1999-2014
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