A logistics company uses a microservices-based application to track cargo pallet lifecycle events such as received, scanned, sorted, and loaded. If these updates are processed out of sequence, the inventory database becomes corrupted. The company needs to decouple the ingestion service from the backend database while ensuring that the updates for each individual pallet are processed in the exact chronological order in which they were generated. Which solution meets these requirements with the least operational overhead?
- APublish the updates to an Amazon SQS Standard queue, and configure a message deduplication ID based on the event timestamp to guarantee chronological ordering.
- Publish the updates to an Amazon SQS FIFO queue, using the pallet ID as the message group ID, and use consumer instances to process the messages.Cevap
- CPublish the updates to an Amazon SNS Standard topic, and subscribe multiple Amazon SQS Standard queues to process the updates in parallel.
- DPublish the updates to an Amazon SQS Standard queue, and use Message Group IDs to group and order the messages during consumer retrieval.
Cevap
Publishing the updates to an Amazon SQS FIFO queue, using the pallet ID as the message group ID, and using consumer instances to process the messages is the correct solution.
Publishing the updates to an Amazon SQS FIFO queue ensures that messages are processed in the exact order they are received. Using the pallet ID as the message group ID ensures that events for any single pallet are processed sequentially, preventing database corruption, while enabling parallel processing of different pallets across multiple consumers.
Adım Adım Çözüm
Anahtar Kavram
Amazon SQS FIFO queues provide first-in, first-out delivery. By using Message Group IDs, you can group messages so that messages within the same group are processed in order, while allowing multiple consumer instances to process different groups in parallel.