哪个“平台”我们应该使用通知程序组件吗?
我们需要开发一个通知程序组件。它将执行的操作是按给定的时间间隔(例如每 15 分钟)扫描数据库,以查看是否需要发送任何通知。
我们在 Windows 上运行,因此我们一直在研究 Windows 服务或 Windows 任务计划程序。
我们最关心的是我们实施的稳健性。如果由于某种原因崩溃了,它可以在下一个间隔自动重新启动吗?我们可以使用自定义日志逻辑来处理崩溃吗?
我想对这里使用什么进行有根据的猜测:)如果您需要额外的信息,请随意说,以做出这样的猜测。
如果有人可以列出 Windows 的优点和缺点,我们将给予支持。服务与 Windows 任务计划程序。另外,应该指出的是,我们还没有对其中任何一个进行设置,所以如果您有任何替代方案,请务必发布。
提前致谢 :)
We need to develop a notifier component. What it will do, is to scan a database at given intervals (say, every 15th minute), to see if any notifications needs to be sent out.
We're running on Windows, and so we've been looking into either a Windows Service or the Windows Task Scheduler.
Our biggest concern is the robustness of our implementation. If it, for some reason, crashes, can it be auto-restarted the next interval? Can we use custom logging logic, to take care of crashes?
I'd like an educated guess on what to use here :) Feel free to say if you need additional info, to make such a guess..
Props will be given if someone could make a short listing of the pros n cons of a windows service vs. the windows task scheduler. Also, it should be noted, that we aren't set on either of these, so if you have any alternatives, please, do post away.
Thanks in advance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您的应用程序不需要连续运行,那么使用任务计划程序有一些优势。设置起来比较容易,您可以将应用程序配置为每 15 分钟运行一次、执行查询、发送通知、安排下次运行并关闭。然而,考虑到 15 分钟的间隔,您可能最好将其实现为 Windows 服务,因为如此频繁地生成和终止进程的开销可能会抵消不让它连续运行的好处。
Windows 服务
优点
缺点
任务计划程序
优点
缺点
If your application doesn't need to run continuously, there are some advantages to using the task scheduler. It's somewhat easier to setup and you can configure your application to run every 15 minutes, execute it's query, send out its notifications, schedule its next run and shut down. Given the 15 minute interval, however, you may be better off implementing this as a Windows Service since the overhead of spawning and terminating the process so often may negate the benefits of not having it running continuously.
Windows Service
Advantages
Disadvantages
Task Scheduler
Advantages
Disadvantages