Question

I've build a simple task management webapp: User A fills up a form, hits submit button, sends data to a server and if the data validates User B gets assigned to this task.

I'd like to notify User B by email on this new assignment. However User A can alter the task data or even delete the task and the email that already has been sent would be incorrect in this case.

One approach is to delay the notification email for couple of minutes and then upon sending update the email message if needed.

Which are the best practices for notifications sending?

Was it helpful?

Solution

I think you have a few choices:

  1. Send out emails whenever task status changes. Don't include details; send a link to user B to let them see what the changes are.
  2. This is a good example of Why Starbucks Does Not Use Two Phase Commit. User B will tolerate "dirty reads" because they aren't life altering.
  3. Send out all notification emails asynchronously on a fixed schedule. Have a timed task query a database, generate all the emails, and send them at once. The task will have the chance to only send the latest one. If user A assigns a task, makes updates, then deletes, user B will only get the last meaningful one. In this case, an assign followed by a delete might result in no email being sent. Only an assign or update as last state will result in an email being sent.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top