For Challenge #2 of the ‘25 days of Serverless’ challenge, we are to implement a solution to send Lucy reminders regarding coffee-making steps and candle-lighting at various times accordingly.
I decide to implement based on the sample scenario listed on the challenge:
For this, I figure the easiest way will be to use:
- Azure Logic Apps as the service
- Scheduling and looping functions for coordination
- Email connector & action for sending emails
Below is my solution in the Logic App Designer. I created 2 streams:
- Candle lighting
Here is the ARM Template
As candle-lighting is required every 10 minutes, I used the ‘Until’ control, where inside I used a ‘Delay’ 10 seconds control, which after that, fires off an email.
For coffee-making, I followed the timeline as per the one listed above and made use of ‘Delay Until’ controls where I compared it against an Add Minutes expression from the Start Time. This variable is set at the Initialize StartDateTime variable action.
Reason for 2 streams:
- Candle lighting activity has no dependency from coffee-making and recurs every 10 minutes.
- Dependency factor in the coffee-making stream. It only makes sense to be able to distribute coffee only after the coffee has been successfully made etc. This allows me to use Configure to run after antod ensure that the subsequent action should only be performed after the preceding action succeeded.
Also for configuration purposes, I used Parameters to store stuff such as the Sender Email, rather than hardcoding at every Send Email action.
For my ‘Send Email’ action, the ‘To’ refers to this email parameter ‘Email’