Notification System
Reliably deliver push, email, and SMS notifications at millions per second.
Marketing schedules a campaign to 20 million people for 9am. At 09:00:01 it lands in your notification system all at once.
Somewhere behind those 20 million messages is a password reset code, for somebody staring at a login screen right now. If both go through the same queue, that code arrives eleven minutes later, which is to say it may as well not arrive at all.
Now add that some of these cost money to send, that people can opt out of some categories and not others by law, and that a phone number can be wrong forever while an email address is fine.
It is the post office of a backend. Every other service hands it messages, and it worries about addresses, delivery, return to sender, and how much any of it costs.
Lessons
4 in this chapter- Requirements and the API ContractYou are building a platform other teams call, so the API contract is a first-class design decision.3 min
- The Delivery PipelineEvent in, Kafka between every stage, channel workers out, and third parties at the edge.3 min
- Retries, Dead Letters, and IdempotencyAt-least-once delivery plus idempotency keys beats chasing exactly-once across third parties.3 min
- Preferences, Rate Limits, and PriorityThe features that protect users from your own company are the ones that keep notifications working.3 min