Soru

Zorluk: OrtaMessage-Based Integration using Amazon SQS and SNS

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?

  1. 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.Cevap
  2. B
    Ingest 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.
  3. C
    Configure a standard Amazon SNS topic subscribed to a standard Amazon SQS queue, and set the queue's visibility timeout to 00 seconds to ensure that messages are immediately visible and processed in arrival order.
  4. D
    Configure 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.

Cevap

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.

Adım Adım Çözüm

1
Select the appropriate messaging queue and topic type that supports ordering.
Amazon SNS FIFO and Amazon SQS FIFO are selected, as standard SQS queues do not guarantee first-in, first-out ordering.
FIFO delivery is a strict requirement for constructing accurate route histories per truck.
2
Determine the logical partition key for ordered processing.
The truck's unique identifier is selected as the Message Group ID.
Using the truck ID as the Message Group ID guarantees that location updates for any single truck are processed in sequence, while allowing concurrent processing of messages belonging to different trucks.
3
Configure the subscriber endpoint integration.
The Amazon SQS FIFO queue is subscribed to the Amazon SNS FIFO topic.
This allows fanout capability if additional downstream consumers need ordered messages, while ensuring that the SQS queue consumes messages in the correct sequence.

Anahtar Kavram

Ordering and parallelism in SQS FIFO and SNS FIFO using Message Group IDs
Tahmini Süre:1m 30s
Bu soruyu puanla