A developer is building a fleet management application that tracks real-time GPS location updates from delivery trucks. To build accurate route histories, the location updates for each individual truck must be processed in the exact order they are sent by the vehicle. However, updates from different trucks can be processed concurrently. The developer plans to use AWS integration services to decouple the data ingestion from the processing backend.
Which configuration will meet these requirements while maximizing scalability and throughput?
- Configure an Amazon SNS FIFO topic and subscribe an Amazon SQS FIFO queue to it. Set the Message Group ID to the truck's unique identifier when publishing updates to the SNS FIFO topic.Answer
- BIngest the location updates using an Amazon Kinesis Data Stream, and configure a static string as the partition key for all records to ensure they are processed sequentially by a single consumer.
- CConfigure a standard Amazon SNS topic subscribed to a standard Amazon SQS queue, and set the queue's visibility timeout to seconds to ensure that messages are immediately visible and processed in arrival order.
- DConfigure a standard Amazon SQS queue that triggers an AWS Lambda function, and store the last processed sequence number in the Lambda function's global variables to track and re-order updates in memory.
Answer
Configure an Amazon SNS FIFO topic and subscribe an Amazon SQS FIFO queue to it. Set the Message Group ID to the truck's unique identifier when publishing updates to the SNS FIFO topic.
Using an Amazon SNS FIFO topic subscribed to an Amazon SQS FIFO queue guarantees ordered message delivery. By setting the Message Group ID to the truck's unique identifier, messages for a specific truck are grouped together and processed sequentially, while messages with different Message Group IDs (other trucks) are processed in parallel. This configuration satisfies the ordering constraint per truck while maintaining high concurrency across the fleet.
Step-by-Step Solution
Key Concept
Ordering and parallelism in SQS FIFO and SNS FIFO using Message Group IDs
Estimated Time:1m 30s