Introduction to Event-Driven Architecture
Traditional monolithic applications often rely on synchronous communication, where one service must wait for another to finish before moving on.
- The Problem with Synchronous: If a user registers, forcing the API to wait while a welcome email sends creates a terrible user experience and risks request timeouts.
- Message Queues: By introducing a message queue (like RabbitMQ or AWS SQS), the API simply fires an “UserRegistered” event and immediately responds to the user. A separate background worker picks up the event later to send the email.
- Decoupling Systems: This architecture completely isolates failure domains. If the email provider’s API goes down, the core application continues running normally, and the queued emails simply wait until the service recovers.