Question

Difficulty: MediumDecoupling Architectures and Event-Driven Messaging

A software-as-a-service (SaaS) provider is building a collaborative document editing platform. When a user updates a document, the platform must send change notifications to a real-time collaboration service and a document version history service. The updates for each individual document must be processed in the exact order they occur to prevent version conflicts. Which combination of steps should a solutions architect take to decouple these services while ensuring correct update order? (Select TWO.)

  1. Publish the update events to an Amazon SNS FIFO topic using the document ID as the message group ID.Answer
  2. Create two Amazon SQS FIFO queues, subscribe them to the SNS FIFO topic, and have each backend service consume messages from its own queue.Answer
  3. C
    Publish the update events to an Amazon SNS Standard topic, and subscribe two Amazon SQS FIFO queues to it.
  4. D
    Create a single Amazon SQS FIFO queue and have both backend services poll messages from this queue simultaneously.
  5. E
    Create an Amazon SNS FIFO topic and subscribe two Amazon SQS Standard queues to it to allow rapid parallel processing.

Answer

To decouple the services while preserving ordering and enabling fan-out, publish update events to an Amazon SNS FIFO topic with a message group ID based on the document ID, and subscribe two Amazon SQS FIFO queues to the topic, with each backend service consuming from its own queue.
Publishing events to an Amazon SNS FIFO topic with a message group ID based on the document ID ensures that all updates for a specific document are ordered sequentially and delivered to subscribers in that order. Subscribing two separate Amazon SQS FIFO queues to the SNS FIFO topic allows the message to be fanned out so that both backend services receive every event, and using SQS FIFO queues ensures that the order is preserved during consumer processing.

Step-by-Step Solution

1
Identify the need for event fan-out to multiple independent backend services.
Confirm that both the real-time collaboration service and the version history service must receive every event.
This establishes that a fan-out architecture (SNS) is required.
2
Choose a messaging service that supports fan-out while preserving strict message ordering.
Select Amazon SNS FIFO as the pub/sub component.
SNS FIFO guarantees first-in, first-out delivery to its subscribers.
3
Group messages by the document ID during publication.
Updates for the same document are processed sequentially.
Using the document ID as the message group ID ensures ordering is maintained per document while allowing parallel processing across different documents.
4
Ensure each receiving service has its own dedicated queue subscribed to the SNS FIFO topic.
Two SQS FIFO queues are created and subscribed to the SNS FIFO topic.
Each service requires a separate queue to receive all events (fan-out), and using SQS FIFO queues preserves the ordering guaranteed by the SNS FIFO topic.

Key Concept

End-to-end FIFO ordering in a fan-out architecture using SNS FIFO and SQS FIFO.
Rate this question