views:

35

answers:

1

Hi all

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

+2  A: 

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
Jim Lamb