Read this story as text
Notifications: the story, written out
Your order is on the way, one line on a lock screen. Nami, a cloud architect, builds the serverless AWS setup behind it: EventBridge, SQS, Lambda, DynamoDB, SNS, Step Functions and dead-letter queues.
- Your phone buzzes: 'rider outside'. Now it buzzes three times. How do we stop that?
- Every service has news, and none knows what the others already said. A recipe for spam.
- Three rules to keep: Tell the right person, on the channel they chose. Say it once, even when events repeat. Never become the app that people mute.
- Wait for the queue per channel. That is where most systems break. Scroll.
- Everyone has news. Checkout, dispatch, tracking: all have news. But none sends a message. They only announce a fact on the event bus. Why?
- One front line. So one service owns messaging. A rule drops events into one queue. A thousand at once? They wait in line, nothing is lost.
- Should we tell them? A function asks: who is this about, and what do they want? A promotion at two a.m. gets dropped. A rider at your door never does.
- Say it once. Events arrive twice. So each has an id, written with a condition: only the first wins. Nobody gets three buzzes.
- Write it for a person. Messages come from templates, per language, with slots for names and times. Services publish facts, never copy.
- A queue for each channel. Push, SMS and email each get their own queue. A slow email provider must never hold up 'rider outside'. Different speeds, different lanes.
- Send, with manners. A function sends through SNS and SES, inside every limit, backing off when told. Hammer a limit, lose messages. And when sending fails?
- When sending fails. Failed sends retry, then land in a dead-letter queue for a human. Dead push tokens get deleted, never retried forever.
- Later, only if it still matters. 'You left something in your cart': thirty minutes later, only if they did not order. A workflow waits, checks, then sends or ends.
- Not too many. Without a cap, someone gets nine messages an hour and mutes us. So there is a cap per person, and low priority gets bundled or dropped.
- Did it arrive? SNS and SES report delivered, bounced, opened. Numbers by channel. Silence is data too.
- Watch the line. I watch the oldest message in the front queue. Minutes means 'rider outside' arrives after he left.
- The whole picture. That is one message, event to lock screen. Trace one, or open the full diagram.
More stories on Real-world systems