Lecture 03. Asynchronous communication with RabbitMQ
Week 5 · Syllabus and preparation from the course outline; no study date or personal lecture notes have been recorded.
Business scenario
Checkout now involves slower payment and notification work; the API should accept the order without waiting for all downstream tasks.
Topics to cover in this class
- Synchronous requests, asynchronous events, queues and event-driven architecture
- RabbitMQ exchanges, queues, bindings, routing keys and consumer groups
- Event envelopes, event_id/correlation_id, message lifecycle and state transitions
- Manual acknowledgements, requeue, publisher confirms and dead-letter behavior
- At-least-once delivery, duplicate deliveries and failure-safe consumers
Learning objectives
- Trace an order across API, message broker and payment worker.
- Demonstrate redelivery after a worker crash.
- Explain why broker ACK is not exactly-once business execution.
Live demonstration checklist
- Place an order returning 202, then observe asynchronous transition to terminal status.
- Interrupt payment worker before ACK; restart and inspect redelivered message.
Preparation and optional written reflection (ungraded)
Reading focus: Read RabbitMQ confirms/acknowledgements documentation; identify the difference between publisher confirm and consumer acknowledgement. Optional individual reflection: A worker updates a database but crashes before acknowledging a message. What can happen next?
Study materials: official docs, websites and YouTube
Official | RabbitMQ tutorials | https://www.rabbitmq.com/tutorials Work queues, publish/subscribe, and Go examples
Official | RabbitMQ acknowledgements and confirms | https://www.rabbitmq.com/docs/confirms Durability and at-least-once handling
Official | RabbitMQ dead letter exchanges | https://www.rabbitmq.com/docs/dlx Message rejection and dead-lettering
Website | Microservices event-driven architecture | https://microservices.io/patterns/data/transactional-outbox.html Dual-write problem and transactional outbox
YouTube | RabbitMQ Architecture Explained | https://www.youtube.com/watch?v=J3pVu6S4Yo8 Producers, queues, exchanges, consumers, ACKs