Message Queues
In this chapter, we handle a flash sale in Shopend by accepting each order now and placing it later, and we use a message queue to hold the orders until they are placed.
After reading this chapter, you should be able to:
- Explain why every order in a flash sale runs one after another on the same primary
- Explain why more instances, a bigger server, load shedding, and throttling each fail to handle the flash sale
- Define asynchronous processing, and distinguish synchronous and asynchronous communication
- Explain why accepting orders now and placing them later meets the response time requirement and keeps the rules of placing an order
- Define message, message queue, broker, producer, and consumer
- Explain how the storefront learns that an order is placed or failed
- Describe the job of the producer, the broker, and the order worker
- Compare a queue on each instance with one shared queue, and explain what Shopend requires of the broker
- Design a queue between two services, and decide when work should go through a queue
- Name the benefits of a message queue and the topics this chapter leaves out