Soru

Zorluk: OrtaDecoupling Architectures and Event-Driven Messaging

A retail company is designing an event-driven system to process stock level updates from its physical stores. The updates must be processed in the exact order they occur for each product SKU to prevent database write conflicts and maintain accurate inventory levels. The system must also be able to scale and absorb sudden spikes in update traffic during promotional sales events.

Which solution meets these requirements with the least operational overhead?

  1. Publish the updates to an Amazon SNS FIFO topic. Subscribe an Amazon SQS FIFO queue to the topic, and configure an AWS Lambda function to process the messages from the queue.Cevap
  2. B
    Publish the updates to a standard Amazon SNS topic. Subscribe a standard Amazon SQS queue to the topic, and configure an AWS Lambda function to process the messages from the queue.
  3. C
    Publish the updates to a standard Amazon SQS queue, and configure an AWS Lambda function to consume the messages using FIFO consumer configuration.
  4. D
    Publish the updates to an Amazon Kinesis Data Stream configured with a single shard, and configure an AWS Lambda function to process the records sequentially.

Cevap

Publish the updates to an Amazon SNS FIFO topic, subscribe an Amazon SQS FIFO queue to the topic, and configure an AWS Lambda function to process the messages.
Utilizing an Amazon SNS FIFO topic combined with an Amazon SQS FIFO queue guarantees that messages are processed sequentially per product SKU (by using the SKU as the message group ID). This architecture ensures that stock updates are processed in the order they occurred, while AWS Lambda dynamically scales up to handle promotional traffic spikes without managing servers, minimizing operational overhead.

Adım Adım Çözüm

1
Determine the decoupling and sequencing requirements.
Identified that events must be decoupled and processed in first-in, first-out order relative to each product SKU.
Sequential order prevents write conflicts and maintains inventory integrity.
2
Select the appropriate AWS messaging integration services that support ordering.
Chose Amazon SNS FIFO and Amazon SQS FIFO to route and queue updates while maintaining order.
Standard message routing options do not guarantee ordering and cannot satisfy the primary constraint.
3
Select a processing backend that minimizes operational overhead and handles sudden scale.
AWS Lambda is configured to consume batches from the SQS FIFO queue.
Lambda is serverless, requires no infrastructure provisioning, and automatically scales in response to queue depth.

Anahtar Kavram

Decoupling and ensuring sequential event processing using FIFO SNS and SQS integration patterns.
Bu soruyu puanla