1

I have created a site to book meetings and now I need to create a service (possibly part of same project?) to check the database and see if there are any meetings taking place within the next hour. So it would have to run every 5 minutes or even 15 minutes.

If meetings are occurring in the next hour it will send an email to the stakeholders.

I don't really require code, just want a bit of a head-start and to know if I can use an ASMX Web Service or if there is a better way of doing this. It seems so far from all tutorials I have read through that Web Services just make functions available to be called.

SharpCode
  • 1,385
  • 3
  • 12
  • 29
  • http://stackoverflow.com/questions/13019433/calling-method-on-every-x-minutes – Mark C. Jan 04 '16 at 22:27
  • 2
    This sounds more like a WIndows Service. A framework like https://www.nuget.org/packages/Topshelf.Quartz would make it very easy to create the schedule. – stuartd Jan 04 '16 at 22:27
  • Thanks @stuartd I'll take a look at some Window Service stuff and that framework. – SharpCode Jan 04 '16 at 22:49

2 Answers2

1

A web service isn't needed unless you plan on having your clients (web/mobile/windows) call the service to check what meetings are coming up in the next hour or if your app/job that checks for meetings calls the web service to handle the sending of emails. If you were trying to do a push notification to your clients (web/mobile/windows) instead of a pull, then you would want to use something like WebSockets to keep a connection open to a server and have the server push notifications back to the client when new meetings are available. As the above indicates, like you clued in on, web services provide the ability to call a "function" (model) remotely/out of process.

To schedule something that will run within the app and continually check the database for new meetings or meetings that are now within the 1 hour mark you could use a scheduler like @stuartd suggested. Then at the end of the job, send emails.

If you need to go bigger with more decoupling you could have a job that simply watches the data for meetings that are new/within the period of time you need. Instead of that job sending the email, you could have a messaging system, like Kafka, running that you send these messages to. At that point you setup a simple app that would read the message from the messaging system to process it and send emails. This is no doubt a larger design and implementation, however it will give you more flexibility with regards to the workflow flexibility, scaling out, and the use of the messaging for other things.

  • It's a website so not sure if an app inside will work. I was hoping to have some sort of service/job on the server the site is running on that checks. – SharpCode Jan 04 '16 at 23:18
  • You could always create another app (service/jobs are generally apps targeting a specific OS). Be careful running this kind of job on the same server/box you have your web app on. Depending on how you do it, you could cause resource strains for your web app while the job is running. Really, you just need to create another application. It could be a web or OS based application, whatever you preference. – Don Colorado Jan 06 '16 at 06:10
0

So I've decided to go with a Window Service that will use a timer to run every 30 minutes. It will perform a check for meetings that are occurring in an hours time and send a notification out (email).

To install it I am using the Installutil tool via command prompt.

Here is a tutorial that helped me. Develop/Install windows service

SharpCode
  • 1,385
  • 3
  • 12
  • 29