Amazon SQS 00:00:01 Receiving a job does not remove it An image worker receives an order to build a thumbnail. Amazon SQS makes an ordinary received message temporarily invisible to other consumers. Who removes it if the worker finishes? The producer sends order 42. SQS stores copies and answers with a message id. Worker A was waiting in a long poll and gets the message with a receipt handle. Worker B polls too. The message is in flight, so B gets nothing. The work is saved. Worker A deletes with its handle. The receipt handle belongs to a particular receive, so use the current one for deletion. Visibility is a processing lease, not a permanent ownership record. 00:00:46 The worker disappears midway Set the example visibility timeout to thirty seconds. The worker might finish writing the thumbnail and fail just before SQS hears about the result. Worker A receives order 42. It is hidden until second 30. Worker A charges the card and then dies. There was no delete. The timeout has passed. The message is visible again. B charges with the same idempotency key, the card is not charged twice, and B deletes. Make a repeated job safe using a stable job identity and a durable completion check. Hiding a message for longer cannot make an external side effect atomic with deleting the message. 00:01:29 Long jobs need a heartbeat A higher-resolution video can outlive the original visibility period. An active worker can extend visibility as it makes progress, subject to the queue's limits. Worker A takes a video job and asks for 120 seconds. Still working. It extends by 120 seconds, counted from now. Again. Without the beat the message would be visible now. Finished and deleted. Extending never goes past 12 hours from the receive. A very long fixed timeout delays recovery when a worker dies. Short renewable intervals trade extra requests for a faster return of abandoned work. 00:02:08 Order the operations for one cart A shopper adds an item and immediately pays. In a FIFO queue, messages with the same group identifier can be kept in sequence while other groups progress independently. Cart 1 has add and pay, cart 2 has add. Worker A asks for one message and gets the oldest, the add of cart 1. Cart 1 has a message in flight, so worker B gets cart 2. Any free worker may take it. Order belongs to the group, not to a worker. One very busy group can become a serialization point. Pick a grouping key that matches the business ordering rule instead of accidentally placing the entire shop in one line. 00:02:50 Recover jobs that repeatedly fail A message is received again and again because its thumbnail source cannot be read. After the configured receive threshold, a redrive policy can move it to a dead-letter queue. Order 7 has a broken field. Worker A fails and does not delete. The next receive would be number 4. SQS moves order 7 instead of handing it out. The alarm on the dead-letter queue fires. Somebody reads the message and fixes the code. After the fix a move task sends order 7 back, and it succeeds. Alert on that queue and investigate before returning work to the main queue. The complete design answers when an item can reappear, who owns recovery, and how a duplicate avoids producing duplicate results.