Soru

Zorluk: OrtaMessage-Based Integration using Amazon SQS and SNS

A developer is designing a decoupled backend architecture for a banking application to process real-time transaction events. The application requires that transaction events are processed in the strict order they occur, and duplicate transactions must be prevented. The developer configures an Amazon SNS FIFO topic to receive transaction events. The developer wants to fan out these events to two different backend consumer services: a ledger service and a fraud detection service. To support this, the developer creates an Amazon SQS FIFO queue named LedgerQueue.fifo and an Amazon SQS Standard queue named FraudQueue. When attempting to subscribe both queues to the SNS FIFO topic, the subscription for FraudQueue fails. How can the developer resolve this subscription failure while maintaining the application's strict ordering and duplication requirements?

  1. Convert the fraud detection queue to an Amazon SQS FIFO queue, rename it to FraudQueue.fifo, and subscribe it to the Amazon SNS FIFO topic.Cevap
  2. B
    Initialize the AWS SDK client used by the publisher with hardcoded AWS access keys that have IAM policy permissions to bypass Amazon SNS FIFO delivery restrictions.
  3. C
    Configure the standard queue's visibility timeout to 0 seconds to ensure immediate message delivery from the Amazon SNS FIFO topic.
  4. D
    Create an intermediate AWS Lambda function with a custom timeout that reads from the topic and writes to the standard queue, relying on Lambda execution context reuse to maintain ordering.

Cevap

Convert the fraud detection queue to an Amazon SQS FIFO queue, rename it to FraudQueue.fifo, and subscribe it to the Amazon SNS FIFO topic.
Amazon SNS FIFO topics can only deliver messages to Amazon SQS FIFO queues to maintain end-to-end message ordering and deduplication. Therefore, the standard SQS queue must be converted to a FIFO queue with the .fifo suffix in order to successfully subscribe to the SNS FIFO topic.

Adım Adım Çözüm

1
Analyze the subscription error between Amazon SNS FIFO and SQS queues.
Identify that the standard SQS queue (FraudQueue) is incompatible with the SNS FIFO topic.
AWS restricts SNS FIFO topic subscriptions to SQS FIFO queues only to guarantee end-to-end FIFO delivery.
2
Select the correct SQS queue type to support the required integration.
Determine that FraudQueue must be re-created as a FIFO queue with the .fifo suffix.
FIFO SQS queues support strict ordering and deduplication, satisfying both application requirements and SNS FIFO topic requirements.
3
Subscribe both FIFO SQS queues to the SNS FIFO topic.
LedgerQueue.fifo and FraudQueue.fifo are successfully subscribed to the SNS FIFO topic.
Both endpoints are now SQS FIFO queues, which is a supported configuration for SNS FIFO delivery.

Anahtar Kavram

Amazon SNS FIFO and Amazon SQS FIFO integration constraints
Tahmini Süre:1m 30s
Bu soruyu puanla