Question

Difficulty: MediumMessage-Based Integration using Amazon SQS and SNS

A developer is designing a retail ordering system. When an order is placed, the payment service must notify both a Fulfillment service and an Inventory service. Both services must receive and process every order message independently. The Inventory service processes messages at a slower rate than the Fulfillment service, so each service must be able to buffer and consume messages at its own pace. Which combination of steps should the developer perform to meet these requirements? (Select TWO.)

  1. Publish the order messages to an Amazon SNS topic when an order is placed.Answer
  2. Create two separate Amazon SQS queues—one for the Fulfillment service and one for the Inventory service—and subscribe both queues to the Amazon SNS topic.Answer
  3. C
    Create a single Amazon SQS queue for both services to poll, and configure the queue's visibility timeout to 0 seconds to allow concurrent processing.
  4. D
    Hardcode the IAM access key and secret access key in the AWS SDK client configuration within the service applications to poll messages from the queue.
  5. E
    Deploy the consumer applications inside a private VPC subnet without a NAT Gateway or VPC Endpoint to access AWS messaging services.

Answer

Publish the order messages to an Amazon SNS topic when an order is placed, and create two separate Amazon SQS queues—one for the Fulfillment service and one for the Inventory service—and subscribe both queues to the Amazon SNS topic.
Publishing messages to an SNS topic and subscribing separate SQS queues for the Fulfillment and Inventory services implementation creates a reliable fan-out pattern. This ensures that every message is delivered to both queues, allowing each service to retrieve and process the messages independently and at its own pace.

Step-by-Step Solution

1
Analyze the architectural requirements for sending messages to multiple downstream systems that process data at different speeds.
Identify that a message fan-out pattern is required to deliver the same message to multiple destinations, and queueing is needed to allow consumers to process messages at their own rate.
Downstream consumers process messages independently, so they cannot share a single queue without competing for messages. SNS handles broadcasting, while SQS handles buffering.
2
Select the SNS topic publication step to serve as the message publisher.
Choose the action to publish order messages to an SNS topic when an order is placed.
SNS topics natively support pushing a message to multiple subscriptions simultaneously.
3
Select the SQS subscription step to create message buffers for each service.
Choose the action to create separate SQS queues for Fulfillment and Inventory, and subscribe them to the SNS topic.
This decouples the services, ensuring that if one service is slow, it does not drop messages or affect the other service.

Key Concept

Implementing the Amazon SNS-to-SQS fan-out pattern for decoupled, multi-consumer message processing.
Estimated Time:2m 0s
Rate this question