A developer is designing a decoupled backend for a ridesharing application to handle completed trip events. When a trip ends, the system publishes a trip event that must be processed by two independent microservices:
1. A trip analytics service that calculates aggregate metrics and consumes messages from an Amazon SQS Standard queue.
2. A financial ledger service that updates customer balances in the exact order the trips occurred, utilizing an Amazon SQS FIFO queue.
The developer wants to implement a fanout pattern using Amazon SNS to distribute these events.
Which architectural configuration will successfully support this integration?
- Create an Amazon SNS Standard topic to publish events to the SQS Standard queue, and create a separate Amazon SNS FIFO topic to publish events to the SQS FIFO queue.Cevap
- BCreate a single Amazon SNS FIFO topic, subscribe both the SQS Standard queue and the SQS FIFO queue to it, and configure the SQS Standard queue visibility timeout to zero.
- CCreate a single Amazon SNS Standard topic, subscribe the SQS Standard queue to it, and route messages to the SQS FIFO queue via an AWS Lambda function that maintains ordering using persistent execution context variables.
- DCreate a single Amazon SNS Standard topic, subscribe both queues to it, and initialize the downstream AWS SDK clients using static IAM user access keys.
Cevap
Create one Amazon SNS Standard topic to publish events to the SQS Standard queue, and create a separate Amazon SNS FIFO topic to publish events to the SQS FIFO queue.
The correct configuration uses two separate SNS topics (one Standard and one FIFO) to publish to their respective SQS queues. This is required because Amazon SNS FIFO topics only support subscriptions from SQS FIFO queues, and Standard SQS queues cannot subscribe to SNS FIFO topics. Similarly, SQS FIFO queues cannot subscribe to Standard SNS topics. To support both downstream consumer types, separate paths must be implemented.
Adım Adım Çözüm
Anahtar Kavram
Integration compatibility rules between Amazon SNS topics (Standard/FIFO) and Amazon SQS queues (Standard/FIFO).