Soru

Zorluk: OrtaMessage-Based Integration using Amazon SQS and SNS

A developer is designing an integration for an e-commerce platform's inventory and shipping services. When a customer places an order, both the inventory service and the shipping service must receive the order details. The services must process orders in the exact order they were placed to maintain correct inventory levels and shipping sequences. If processing fails for a specific customer's order, it must not block the processing of orders for other customers. Which combination of actions will meet these requirements? (Select TWO.)

  1. Publish the order events to an Amazon SNS FIFO topic, and subscribe two Amazon SQS FIFO queues to the topic to fan out the messages.Cevap
  2. Use the customer ID as the MessageGroupId when publishing the order events.Cevap
  3. C
    Use a single standard Amazon SQS queue, and configure both the inventory and shipping services as competing consumers.
  4. D
    Configure the SQS visibility timeout to be shorter than the downstream consumer's processing time.
  5. E
    Configure the downstream Lambda function's timeout to be greater than the SQS queue's visibility timeout.

Cevap

Publish the order events to an Amazon SNS FIFO topic, subscribe two Amazon SQS FIFO queues to the topic to fan out the messages, and use the customer ID as the MessageGroupId when publishing the order events.
Publishing the order events to an Amazon SNS FIFO topic and subscribing two Amazon SQS FIFO queues allows for ordered fanout, ensuring both downstream services receive every message in the correct sequence. Using the customer ID as the MessageGroupId ensures that messages belonging to the same customer are processed in the order they were received, while messages for different customers are processed in parallel without causing head-of-line blocking.

Adım Adım Çözüm

1
Select the messaging services that support fanout and ordering.
Amazon SNS FIFO and Amazon SQS FIFO queues are selected because standard queues do not guarantee strict ordering or support ordered fanout.
To send the same order event to both the inventory and shipping services while preserving order, a combination of an SNS FIFO topic and SQS FIFO queues is required.
2
Configure the partition and ordering context using message headers.
Set the MessageGroupId to the customer ID.
Using the customer ID ensures that ordering is strictly maintained per customer (avoiding head-of-line blocking for other customers) rather than globally across all orders.

Anahtar Kavram

FIFO Fanout with SNS and SQS using MessageGroupId for logical partitioning
Bu soruyu puanla