exam questions

Exam AWS Certified Developer Associate All Questions

View all questions & answers for the AWS Certified Developer Associate exam

Exam AWS Certified Developer Associate topic 1 question 258 discussion

Exam question from Amazon's AWS Certified Developer Associate
Question #: 258
Topic #: 1
[All AWS Certified Developer Associate Questions]

A company has an AWS Lambda function that reads messages from an Amazon Simple Queue Service (Amazon SQS) queue by using the Amazon SQS API. The Lambda function is not processing all the messages successfully because of random failures of a third-party dependency. A developer needs to improve the reliability of the Lambda function so that the Lambda function will process each message successfully despite the failures of the third-party dependency.

Which solution will meet this requirement with the LEAST effort?

  • A. Move the call to the third-party dependency into an exception handling block. Write the message back to the SQS queue if a failure in the third-party dependency is caught in the exception handler.
  • B. Update the code in the Lambda function to remove calls to the SQS SDK ReceiveMessage function. Configure the Lambda function to use the SQS queue as an event source. Set the maxReceiveCount value on the SQS queue's redrive policy to at least 5.
  • C. Create a second SQS queue to use as a dead-letter queue. Configure a redrive policy on the original SQS queue to send failed messages to the dead-letter queue. Modify the Lambda function to read messages from both queues.
  • D. Create a second SQS queue to use as a dead-letter queue. Move the call to the third-party dependency into an exception handling block. Write the message to the dead-letter queue if a failure in the third-party dependency is caught in the exception handler.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
c9ebec2
1 year, 8 months ago
Selected Answer: A
A. It is infinite retry until the message is processed successfully. D is absolutely incorrect. you can't call it successfully processed when you leave messages in the DLQ.
upvoted 1 times
...
rcaliandro
2 years, 1 month ago
Selected Answer: D
So it's a good idea to create an SQS dead letter queue for this reason A and B are for sure not correct. We have to exclude also the C because create a DLQ Q and modify the lambda function to read messages from both queues doesn't make sense. Instead, it is a good idea to create an SQS Dead letter Queue, catch the application exceptions in the function and write on the DLQ if there is a failure caused by the third-party library. So the answer D is the correct one
upvoted 1 times
...
m4r0ck
2 years, 5 months ago
Selected Answer: D
To me, the key here is 'so that the Lambda function will process each message successfully "despite the failures" of the third-party dependency', which means that we don't necessarily need to reprocess the message, meaning that any answers talking about returning the message back to the SQS queue are wrong. Left are C or D, in C the answer is talking about consuming the messages from the normal queue and from the dead letter queue. again from the first statement, we're not looking to reprocess the failed messages therefore no need to reconsume the messages in the DLQ. so D is the right one in my opinion
upvoted 3 times
...
ezeik
2 years, 5 months ago
Selected Answer: A
I think it's A. 1) least effort - no additional queues 2) unlimited number of retries in this scenario which garanties processing of the message.
upvoted 3 times
ja1092m
1 year, 11 months ago
No read the question "despite the failures of the third-party dependency"
upvoted 1 times
...
...
AmberTheTamber
2 years, 6 months ago
They need to reword "exception handling block". As a developer, to me this means the "catch" or "Except" portion of the code. I disqualified the correct answer based off of that.
upvoted 1 times
...
pancman
2 years, 6 months ago
Selected Answer: D
D is correct. Dead-letter queues are the way to catch and handle errors in SQS.
upvoted 1 times
...
Phinx
2 years, 7 months ago
Selected Answer: D
D for me.
upvoted 1 times
...
KT_Yu
2 years, 7 months ago
Selected Answer: D
D makes the most sense to me. C: Redrive policy should be working on DLQ, not the original queue
upvoted 2 times
ezeik
2 years, 5 months ago
"Set the maxReceiveCount on the source queue's redrive policy to at least five. " https://aws.amazon.com/premiumsupport/knowledge-center/lambda-retrying-valid-sqs-messages/
upvoted 1 times
...
...
by116549
2 years, 7 months ago
Does C not look to be correct based on this resource: https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html
upvoted 2 times
...
almadeedo
2 years, 7 months ago
Selected Answer: B
Choosing B (even if it tolerates just a maximum number of failures equal to the selected maxReceiveCount value). As regarding A, it seems strage the wording "write back to the SQS queue", even if this appears to be the only solution guarantiing the succesfull processing of "each" message (by the way, with this solution we can incurr in infinite loops for structural errors). As regarding D, I was wondering how an immediate move to the DLQ after a single failure will encrease resiliency without using it as a source of the process (following this approach we will have just traces of all the failures in the DLQ but no increased resiliency). As regarding C we're increasing resiliency to just two tries if we don't modify maxReceiveCount. Can anybody argument on my above reasonings?
upvoted 2 times
...
ubuntu1234
2 years, 8 months ago
Changing to D, as we need to create a second SQS queue and link it to the original SQS queue to configure DLQ.
upvoted 1 times
...
ubuntu1234
2 years, 8 months ago
B. https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html If your function returns an error, or can't be invoked because it's at maximum concurrency, processing might succeed with additional attempts. To give messages a better chance to be processed before sending them to the dead-letter queue, set the maxReceiveCount on the source queue's redrive policy to at least 5.(C and D needs to create the DLQ in the same source queue, instead of creating a second queue, which makes them wrong choice)
upvoted 2 times
...
michaldavid
2 years, 8 months ago
Selected Answer: D
Defo not A and B. D makes more sense than C
upvoted 2 times
...
k1kavi1
2 years, 8 months ago
Selected Answer: D
Use dead letter queue with exception handling
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...