What if a Lambda function fails to process an SQS message within the visibility timeout of the queue?

0

When a Lambda function receives an SQS message and fails to process it within the visibility timeout of the queue, which of the following happens?

  • The Lambda function retries to process the message after the visibility timeout ends.
  • The Lambda function retries to process the message as soon as possible, even before the visibility timeout ends.

NOTE:

  • Suppose that the SQS queue is a fifo queue.
2개 답변
1

When you use a queue as an event source mapping for a Lambda function, the Lambda service polls that queue for you. It will behave like any polling code - once a poll reads a message it becomes invisible to subsequent polls unless the visibility timeout is exceeded, then the next poll will pick it up again and another function instance will process it.

전문가
답변함 2년 전
profile pictureAWS
전문가
검토됨 2년 전
0

Please read this document very thoroughly if you haven't done so already, to understand the nuances of how lambda works with an SQS event source - https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html

In particular please take a look at this recommendation - "We recommend setting your queue visibility timeout to six times your function timeout, plus the value of MaximumBatchingWindowInSeconds. This allows time for your Lambda function to process each batch of events and to retry in the event of a throttling error."

profile pictureAWS
전문가
답변함 2년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠