Soru

Zorluk: ZorMessage-Based Integration using Amazon SQS and SNS

A developer is implementing a decoupled transaction processing system. Transaction event messages are published to an Amazon SNS FIFO topic. An Amazon SQS FIFO queue is subscribed to the topic, and an AWS Lambda function consumes messages from the queue.

The system must satisfy these requirements:
- Transactions for the same bank account must be processed in the exact order they are received.
- If duplicate transactions with the exact same payload are published within a 55-minute window, only the first transaction should be processed.
- The AWS Lambda function takes up to 4545 seconds to process a single transaction.

During testing, the developer notices two issues:
1. Transactions for the same bank account are sometimes processed out of order.
2. Transactions that take longer than 3030 seconds to process are occasionally processed a second time by another Lambda invocation.

Which two of the following configuration changes will resolve these issues? (Select TWO.)

  1. Set the MessageGroupId of each published message to the unique bank account ID.Cevap
  2. Set the Lambda function timeout to 4545 seconds and configure the SQS queue's visibility timeout to at least 270270 seconds.Cevap
  3. C
    Configure the SQS queue's visibility timeout to 1515 seconds to ensure that any failed transaction processing is retried immediately.
  4. D
    Set the MessageDeduplicationId of each published message to the unique bank account ID.
  5. E
    Increase the Lambda function timeout to 4545 seconds and reduce the SQS queue's visibility timeout to 3030 seconds.

Cevap

Set the MessageGroupId of each published message to the unique bank account ID, and set the Lambda function timeout to 4545 seconds and configure the SQS queue's visibility timeout to at least 270270 seconds.
To resolve the ordering issue, the developer must set the MessageGroupId to the bank account ID. SQS FIFO uses the MessageGroupId to group messages that must be processed in sequence. Messages in the same group are processed one by one, while messages in different groups can be processed in parallel. To resolve the duplicate processing issue, the Lambda function timeout must be set to at least 4545 seconds to accommodate the maximum processing duration. Furthermore, the SQS visibility timeout must be set to at least 66 times the Lambda function timeout (at least 270270 seconds) to comply with AWS integration best practices, preventing premature message visibility resets during potential Lambda retries.

Adım Adım Çözüm

1
Analyze the ordering requirement per bank account and select the proper SQS FIFO parameter.
Identify that the MessageGroupId must be set to the bank account ID to ensure that messages for the same bank account are processed sequentially by SQS FIFO.
SQS FIFO queues enforce ordering within a specific message group. Messages with different group IDs can be processed concurrently and out of order, which is desired, but messages with the same group ID are processed sequentially.
2
Address the duplicate processing issue caused by long-running transactions.
Determine the required Lambda function timeout and SQS visibility timeout values (4545 seconds and 270270 seconds, respectively).
To prevent duplicate executions of messages that are still being processed, the Lambda function timeout must cover the maximum processing time (4545 seconds), and the SQS visibility timeout must be at least 66 times the Lambda timeout (6×45=2706 \times 45 = 270 seconds) per AWS integration guidelines.
3
Evaluate the duplicate detection requirement within a 55-minute window.
Avoid configuring MessageDeduplicationId with high-collision values (like the bank account ID) or disabling deduplication.
Using the bank account ID as the MessageDeduplicationId would incorrectly block all transactions for that account for 55 minutes. SQS FIFO's content-based deduplication or a unique transaction ID should be used instead.

Anahtar Kavram

Message ordering, deduplication, and visibility timeout configurations in Amazon SQS FIFO and AWS Lambda integrations.
Tahmini Süre:2m 30s
Bu soruyu puanla