1

For some reason, I cannot replicate the retry capabilities stated in the docs in my lambda function at all. I set the Max event age to 1 min, and i set the max retry attempts to 2. Yet when a execute a simple lambda function like below:

if(StringUtils.contains("ERROR_MESSAGE", payload)){
throw new RuntimeException("Example error message");
}

It retries MANY times. Perhaps over 50 times. Is there any way to mimic retry functionality? And why is it retrying so many times?

Also, when using State Machine (Step Function) retries, does it work the same way as using normal retries? If my lambda is triggered by some event source, MSK for example, if the lambda function fails or throws an exception, will it follow the retry scenario specified in the Step Function?

kingkamal
  • 11
  • 2
  • How is this test function being invoked? I think some different invocation methods (being invoked by an SQS trigger for example) have different retry rules. – Mark B Aug 17 '21 at 14:29
  • MSK Trigger. Is there documentation for retry rules for MSK trigger? because i cant find it at all – kingkamal Aug 17 '21 at 20:06
  • 1
    https://docs.aws.amazon.com/lambda/latest/dg/with-msk.html "Lambda reads the messages sequentially for each partition. After Lambda processes each batch, it commits the offsets of the messages in that batch. If your function returns an error for any of the messages in a batch, Lambda retries the whole batch of messages until processing succeeds or the messages expire." – Mark B Aug 17 '21 at 20:45
  • @MarkB apparently you should write up and answer, and I can accept the solution and upvote it. Up to you if you still want to. – kingkamal Jul 15 '22 at 15:48

1 Answers1

0

Thanks Mark!

docs.aws.amazon.com/lambda/latest/dg/with-msk.html "Lambda reads the messages sequentially for each partition. After Lambda processes each batch, it commits the offsets of the messages in that batch. If your function returns an error for any of the messages in a batch, Lambda retries the whole batch of messages until processing succeeds or the messages expire."

kingkamal
  • 11
  • 2
  • For future questions, if someone provides an acceptable answer in comments then it's common practice to ask that person to write up an answer so that you can accept it. And, at the very least, upvote their comment. – jarmod May 26 '22 at 19:35