Soru

Zorluk: KolayMessage-Based Integration using Amazon SQS and SNS

A developer is building a web application that allows users to upload videos. When a video is uploaded, two separate tasks must run in parallel: one to generate a video thumbnail and another to extract metadata. The developer wants to decouple these tasks using a message-based architecture.

Which two actions should the developer take to implement this architecture? (Select TWO.)

  1. Publish the video upload event to an Amazon SNS topic.Cevap
  2. Subscribe two separate Amazon SQS queues to the SNS topic, and configure each service to poll its own queue.Cevap
  3. C
    Create a single Amazon SQS queue and configure both the thumbnail and metadata services to poll this queue.
  4. D
    Initialize the AWS SDK clients within the services by hardcoding the AWS access key ID and secret access key directly in the application code.
  5. E
    Configure the backend services as AWS Lambda functions and set their execution timeout to be longer than the default SQS visibility timeout without updating the queue settings.

Cevap

To implement the required decoupled architecture, the developer should publish the video upload events to an Amazon SNS topic, and subscribe two separate Amazon SQS queues (one for the thumbnail service and one for the metadata service) to that topic.
To send a single event to multiple independent backend services simultaneously, the fan-out pattern is used. Publishing the event to an Amazon SNS topic allows it to be broadcast to multiple subscribers. Subscribing two separate Amazon SQS queues to the SNS topic ensures that both the thumbnail service and the metadata service receive their own copy of the message, decoupling the services and allowing them to process the event in parallel without message loss or competition.

Adım Adım Çözüm

1
Publish the upload event to an Amazon SNS topic.
The event is broadcast to all active topic subscribers.
SNS acts as the publisher in the fan-out pattern, sending a single message to multiple endpoints simultaneously.
2
Subscribe two separate SQS queues to the SNS topic.
Each queue receives its own identical copy of the upload event message.
By having a dedicated queue per consuming service, the services are decoupled and do not compete for the same messages.

Anahtar Kavram

SNS-to-SQS Fan-out Pattern
Tahmini Süre:1m 0s
Bu soruyu puanla