A clinical diagnostic laboratory is building an event-driven system to process patient test results generated by multiple automated analyzers. The results for each patient must be processed in the exact sequence they are completed to prevent older results from overwriting newer ones due to network latency. Results for different patients can be processed concurrently. The system must scale automatically to handle sudden increases in test volumes during peak hours.
Which solution meets these requirements with the least operational overhead?
- ACreate a standard Amazon SQS queue and configure an AWS Lambda function as the consumer. Implement sorting logic in the consumer application to order the results by patient ID before processing.
- BConfigure the analyzers to directly invoke an AWS Lambda function for each event. Have the Lambda function execute a continuous polling loop to wait and collect all test results for a patient before processing them.
- Create an Amazon SQS FIFO queue and configure an AWS Lambda function as the consumer. Send the events to the queue using the patient ID as the message group ID.Answer
- DCreate an Amazon Kinesis data stream. Configure the analyzers to write events to the stream using the analyzer machine ID as the partition key, and process the events using an AWS Lambda function.
Answer
Create an Amazon SQS FIFO queue and configure an AWS Lambda function as the consumer. Send the events to the queue using the patient ID as the message group ID.
The correct solution uses an Amazon SQS FIFO queue with the patient ID as the message group ID. This setup guarantees that all messages belonging to the same patient (the same message group) are processed sequentially, while allowing different patient groups to be processed in parallel. Using AWS Lambda as a consumer provides automatic scaling and minimal operational overhead.
Step-by-Step Solution
Key Concept
Amazon SQS FIFO queues use the MessageGroupId parameter to group messages that must be processed in a strict sequence, allowing multiple consumers to process different message groups concurrently.