A ride-sharing platform is designing an event-driven system to process ride status updates (such as requested, accepted, driver_arrived, and ride_ended) sent from driver mobile applications. To maintain a correct trip history, updates for each specific ride must be processed in the exact sequence they are generated. The platform must handle sudden spikes in traffic during peak hours without losing messages, and the upstream ingestion layer must be decoupled from the downstream processing application. Which solution meets these requirements with the least operational overhead?
- APublish the updates to a standard Amazon SNS topic. Subscribe a standard Amazon SQS queue to the topic, and configure the downstream application to process messages from the queue, relying on the queue's default configuration to preserve ordering.
- BIngest the updates through an Amazon Kinesis Data Firehose delivery stream, configure it to buffer the events, and write them directly to an Amazon DynamoDB table with strong consistency enabled to ensure sequential updates.
- Publish the updates to an Amazon SNS FIFO topic. Subscribe an Amazon SQS FIFO queue to the topic, and configure the downstream application to process messages from the queue using the ride ID as the message group ID.Cevap
- DStore the incoming updates in an Amazon ElastiCache for Redis cluster, and write a custom multi-threaded application on Amazon EC2 to continuously poll the cache and process updates in sequence.
Cevap
Publish the updates to an Amazon SNS FIFO topic. Subscribe an Amazon SQS FIFO queue to the topic, and configure the downstream application to process messages from the queue using the ride ID as the message group ID.
The correct solution uses an Amazon SNS FIFO topic subscribed to by an Amazon SQS FIFO queue. SNS FIFO and SQS FIFO queues guarantee first-in, first-out (FIFO) delivery within a message group. By setting the ride ID as the message group ID, the platform ensures that updates for any single ride are processed in the order they were sent. This serverless solution handles scaling and message buffering automatically, minimizing operational overhead.
Adım Adım Çözüm
Anahtar Kavram
Decoupling event-driven architectures requiring strict message ordering using SNS/SQS FIFO.