A company is building an e-commerce web application on AWS. The application sends information about new orders to an Amazon API Gateway REST API to process. The company wants to ensure that orders are processed in the order that they are received.
Which solution will meet these requirements?
A. Use an API Gateway integration to publish a message to an Amazon Simple Notification Service (Amazon SNS) topic when the application receives an order. Subscribe an AWS Lambda function to the topic to perform processing.
B. Use an API Gateway integration to send a message to an Amazon Simple Queue Service (Amazon SQS) FIFO queue when the application receives an order. Configure the SQS FIFO queue to invoke an AWS Lambda function for processing.
C. Use an API Gateway authorizer to block any requests while the application processes an order.
D. Use an API Gateway integration to send a message to an Amazon Simple Queue Service (Amazon SQS) standard queue when the application receives an order. Configure the SQS standard queue to invoke an AWS Lambda function for processing.
B
技巧:排除明顯錯誤選項,在沒有明顯錯誤的選項中選擇最合理的選項。
某公司正在AWS 上構建電子商務web應用程序處理訂單系統,需要確保訂單按照接收的順序進行處理,需要選擇一個合適的AWS服務組合。
A. 不正確。使用 API Gateway 集成將消息發布到 Amazon Simple Notification Service (Amazon SNS)主題,并訂閱一個 AWS Lambda 函數來處理。SNS 主題主要用于發布/訂閱消息模型,它并不保證消息的順序。因此,這個選項不適合需要保持消息順序的場景。
B. 正確。使用 API Gateway 集成將消息發送到 Amazon Simple Queue Service (Amazon SQS) FIFO 隊列,并配置 SQS FIFO 隊列來調用AWS Lambda函數進行處理。SQS FIFO(First-In-First-Out)隊列正是為了保持消息的順序而設計的。這意味著消息會嚴格按照它們被發送的順序被處理。此外,SQS FIFO可以配置為自動觸發Lambda函數,從而滿足自動處理訂單的需求。
C. 不正確。使用 API Gateway 授權器來阻塞任何請求,直到應用程序處理完一個訂單。該方案并不實用,因為它會阻塞新的訂單請求,直到前一個訂單被處理完畢。這不僅降低了系統的吞吐量,而且在實際應用中很難實現,因為它需要實時跟蹤訂單的處理狀態。
D. 不正確。使用 API Gateway 集成將消息發送到 Amazon Simple Queue Service (Amazon SQS) 標準隊列,并配置 SQS 標準隊列來調用 AWS Lambda 函數進行處理。SQS標準隊列不保證消息的順序。在負載較高的情況下,消息可能會亂序處理。