wpf 轮询mysql数据库,轮询数据库中的表

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.

解决方案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.

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 ).

I think the timer elapsed event should do the trick.

Thanks for the quick advice.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值