The lambda is responsible for sending emails (via Braze) related to payment failures of reader revenue products. In particular, it includes the user's (encrypted) email in any links in payment failure emails, so that the data can be used to facilitate login.
The following diagram illustrates how a payment failure event flows through our AWS infrastructure, resulting in the lambda being invoked.
event => email queue => workflow => sns topic => identity queue => identity lambda
- see this document which records the architectural decisions made when setting up this lambda.
- see
test-payment-failure-email.sh
in membership-workflow as a way of sending events which will invoke the lambda
-
How do I send messages on the dead letter queue to the queue that the lambda reads from (so that message processing) can be retried?
This Stackoverflow answer by Rajkumar provides a convenient way. In summary:
- set the main SQS queue as the DLQ for the actual DLQ with Maximum Receives as 1
- view the content in DLQ (this will move the messages to the main queue as this is the DLQ for the actual DLQ)
- remove the setting so that the main queue is no more the DLQ of the actual DLQ
Note: you won't always want to put messages from the dead letter queue back on the main queue. For example, if email validation fails, it will continue to fail.