Helped with a SQS event processor #244
Replies: 1 comment
-
|
hi @Iamrodos, this sounds like a nifty solution! 🎉 Please check here for a sample using CloudFormation that defines a Role and references it in the Other than CloudFormation, I can't tell what type of iterable And also, watch our for the 15 minute execution limit as it interacts with automatic step retries, defined here. The failing step will attempt retrying automatically. Some suggestions on ESM execution error handling: https://docs.aws.amazon.com/lambda/latest/dg/durable-invoking-esm.html#durable-esm-error-handling If your handlers are not serial, you could also consider using parallel to run concurrently. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We have an SQS-triggered Lambda that processes events, where each event can have multiple handlers (send email, update records, trigger downstream events, etc.). Before durable functions, if handler 3 of 5 failed, the SQS retry would reprocess handlers 1-2 unnecessarily. These handlers were not always idempotent, causing duplicate side effects. Its been a TODO to resolve and durable functions turned into an easy way to do this.
We wrapped our event processor in
@durable_executionand usectx.step()to checkpoint:We use a
DURABLE_EXECUTION_ENABLEDenv var to switch between durable and standard BatchProcessor paths. This lets us roll back instantly without code changes if issues arise.We include the handler index in step names (
handler-0-send_email) to avoid collisions when multiple handlers share the same__name__.The only issue we hit was a circular dependency on CloudFromation when trying to write the role for the Lambda. The IAM role needs the Lambda ARN for checkpoint permissions, but the Lambda needs the Role ARN. Would like to find a way to solve that.
Beta Was this translation helpful? Give feedback.
All reactions