Soru

Zorluk: OrtaDecoupling Architectures and Event-Driven Messaging

An airline is designing an application to process loyalty rewards points accrual events. For each passenger, events must be processed in the exact chronological sequence they are generated to ensure loyalty tiers are calculated accurately. If an event fails to process after five attempts, it must be isolated for investigation without blocking the processing of events for other passengers.

Which solution meets these requirements with the least operational overhead?

  1. A
    Configure a standard Amazon SQS queue with an attached dead-letter queue. Set the passenger ID as a message attribute to guarantee that events for each passenger are processed in order.
  2. B
    Configure an Amazon SNS standard topic to receive the events, and subscribe multiple Amazon SQS FIFO queues to the topic to process messages for each passenger in order.
  3. Configure an Amazon SQS FIFO queue with a dead-letter queue. Set the passenger ID as the message group ID to ensure in-order processing per passenger.Cevap
  4. D
    Configure an Amazon Kinesis Data Stream with a single shard to ingest all events, using the passenger ID as the partition key, and process events using an AWS Lambda consumer.

Cevap

Configure an Amazon SQS FIFO queue with a dead-letter queue. Set the passenger ID as the message group ID to ensure in-order processing per passenger.
The correct solution uses an Amazon SQS FIFO queue. SQS FIFO queues guarantee that messages within the same message group (using the passenger ID as the MessageGroupId) are processed in the exact order they are received. An associated dead-letter queue (DLQ) isolates messages that fail to process after five attempts, allowing other message groups (other passengers) to continue processing without interruption.

Adım Adım Çözüm

1
Evaluate the ordering requirement.
Identified that events must be processed in the exact sequence they are generated on a per-passenger basis.
This requires a messaging mechanism that guarantees ordering based on a unique identifier (passenger ID) rather than requiring global ordering across all passengers.
2
Evaluate the failure isolation requirement.
Identified that failed events must be isolated after 5 retries without blocking other messages.
This indicates the need for a dead-letter queue (DLQ) with a maxReceiveCount of 5 configured on the source queue.
3
Compare SQS FIFO, SQS Standard, SNS standard, and Kinesis Data Streams capabilities.
SQS FIFO with a DLQ and a MessageGroupId of passenger ID satisfies all constraints with minimal configuration.
SQS Standard does not guarantee order, SNS Standard loses ordering before reaching the queues, and Kinesis with a single shard introduces scale limits and higher operational overhead.

Anahtar Kavram

Decoupling message processing using Amazon SQS FIFO queues to guarantee ordered processing within groups (using MessageGroupId) and utilizing dead-letter queues to handle processing failures without blocking other groups.
Bu soruyu puanla