8

I'm trying to understand the difference between a queue trigger and a service bus queue trigger and which one I need!

I have a asp.net mvc site that is for creating and scheduling classes, which will be represented as a row in a db table. When a class is over I want to send an email to all students asking them to rate their teacher

As far as I'm aware the best way to do this is to create a Azure function that will create and send the emails, but where I'm lost is how to trigger that function at a specific date and time?

Do I use a queue trigger or a service bus queue trigger? What's the difference between the two and which one would be the best for my scenario?

I need to be able to cancel the message in the queue if the class is canceled.

chuckd
  • 13,460
  • 29
  • 152
  • 331
  • `Timer` trigger may be? https://stackoverflow.com/questions/34076661/azure-webjob-scheduled-execution-as-well-triggers-by-queue – mike123 Dec 08 '17 at 20:23
  • no because I don't want the function running continuously on a timer (ex. 1/week) – chuckd Dec 08 '17 at 20:30

1 Answers1

5

If cancelling scheduled messages is a hard requirement, only Service Bus allows doing that, see this blog.

However, it might be more practical to just add a check whether the class was cancelled at the beginning of your Azure Function, and quit if so.

For the rest of your scenarios, the services will both fit.

Generally, Service Bus has more advanced capabilities and guarantees, but costs more money if you send lots of messages. I usually pick Storage Queues unless I need any of those more advanced features.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • I also need to be able to run the azure function a few weeks from the time the class is first created. ex. the teacher creates and schedules the class for Monday Jan 1 2018, which is 3 weeks out. So the message has to sit in the queue for three weeks! Will I have a problem with either of these solutions? – chuckd Dec 08 '17 at 20:37
  • Yes, I think they both don't care if it 's 3 hours or 3 weeks – Mikhail Shilkov Dec 08 '17 at 20:43