My program allows users to store appointments in a calendar. What has been requested of me is the ability for SMS reminders to be sent to people to remind them of their appointment. The SMS would need to be sent out about 2 days prior to their appointment.
I thought the best way to achieve this is to choose a time of the day (eg. midday) for the software to check to see which appointments are in 2 days time and then send out the SMS reminders to the people who have those appointments.
Would this be an advisable approach to this problem? Is it advisable to have this happen at one time of the day, or would it be better to somehow spread it out over a longer time?
I am assuming at this point that a background thread would be a good idea for this type of activity.
3
This Question should be proposed to the user, as the ramifications to the user far out way the technical concerns.
The frequency that you call your process should have very little baring on the design.
This is a queue problem. When you set the reminder, you create a “task”. That task has some status, like open and a minimum date time before it may start. So, you check the task list. You can just do that multiple times per day, could even be a continuous process.
When you start working on a task you set it to pending and when done remove it or close it. Depending on the amount of history you want. That way you can always just restart the service, run it on many machines etc. As long as your locking is OK on changing the task status you will be OK.
In general it is advisable if you do this with real queue software. Creating one yourself which is scalable is quite hard actually because of locking issues, servers which get down etc.
2
If its two days prior to the appointment it would in my opinion be sufficient to check once a day. I think outlook does it at startup when you say: remind me 2 days before the event. For me it wouldn’t make much sense to check that hourly, because it probably wont matter if I read the SMS at 8 AM or 6 PM.
Maybe the best way to be sure is to have a use case or requirement of the end user, and ask him when he expects the notification.
Unfortunately I don’t know which language you program in. If it’s Java or C#, you may want to take a look at Quartz (Java, C#). You can easily specify how often and when exactly a task should be executed. Maybe you can use it.
7