哪个“平台”我们应该使用通知程序组件吗?

发布于 2024-09-05 23:00:37 字数 380 浏览 3 评论 0原文

我们需要开发一个通知程序组件。它将执行的操作是按给定的时间间隔(例如每 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

死开点丶别碍眼 2024-09-12 23:00:37

如果您的应用程序不需要连续运行,那么使用任务计划程序有一些优势。设置起来比较容易,您可以将应用程序配置为每 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

  • Can be configured to restart automatically (see the properties of a service in the Service Manager control panel app)
  • Can be configured to run in the context of a different user account
  • Can be remotely started, stopped
  • Continues to run even if no one is logged on

Disadvantages

  • Needs elevation for installation
  • Runs continuously which may or may not be advantageous

Task Scheduler

Advantages

  • Can be configured to run on a schedule of your choosing including complex schedules
  • Can be configured to run in the context of a different user account

Disadvantages

  • If one invocation fails, you'll have to wait until the next invocation, or implement logic to adjust scheduling appropriately
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文