A SaaS payroll application processes employee timesheet submissions. To ensure accurate cumulative tax and overtime calculations, all timesheet update events for any given employee must be processed in the exact order they are received. These events must be delivered to independent downstream microservices: a payroll calculation engine and a compliance audit system. The application experiences traffic spikes of up to events per second. Which solution meets these requirements with the least operational overhead?
- APublish the events to an Amazon SNS Standard topic, and subscribe Amazon SQS Standard queues to the topic, with queue for each microservice. Use the employee ID as the MessageGroupID attribute to group messages.
- BPublish the events to an Amazon Kinesis Data Stream, using the employee ID as the partition key. Configure each microservice to consume events from the stream using the Kinesis Client Library (KCL) running on AWS Fargate.
- Publish the events to an Amazon SNS FIFO topic, and subscribe Amazon SQS FIFO queues to the topic, with queue for each microservice. Enable the high-throughput FIFO feature on both the SNS topic and SQS queues, and use the employee ID as the Message Group ID.Answer
- DPublish the events to an Amazon EventBridge custom event bus. Define rules to route the events to Amazon SQS Standard queues, and configure the queues to use the MessageDeduplicationId attribute based on the employee ID.
Answer
Publish the events to an Amazon SNS FIFO topic and subscribe Amazon SQS FIFO queues to it, enabling high-throughput FIFO on both the topic and queues, and using the employee ID as the Message Group ID.
The correct solution leverages a native AWS serverless messaging pattern for fan-out with strict ordering. By publishing events to an Amazon SNS FIFO topic and subscribing Amazon SQS FIFO queues (one for each microservice), the architecture decouples the services and guarantees exactly-once processing and FIFO delivery. The employee ID acts as the Message Group ID to ensure sequential ordering per employee. Enabling high-throughput FIFO on both the SNS topic and SQS queues allows the application to scale beyond the default limit of transactions per second to accommodate the peak traffic of events per second with minimal operational overhead.
Step-by-Step Solution
Key Concept
Serverless event fan-out with guaranteed ordering using SNS FIFO, SQS FIFO, and High-Throughput FIFO.
Estimated Time:3m 0s