serverless-plugins icon indicating copy to clipboard operation
serverless-plugins copied to clipboard

Feature Idea: Enhance autoCreate to create dead letter queues and redrive policies.

Open tclindner opened this issue 5 years ago • 4 comments

Thank you so much for your hard work on this project! 🎉 It has made it really easy to work with SQS offline. I recently upgraded to v2. The autoCreate functionality works really well. I was able to replace a shell script that used the AWS cli to create queues. The only gap I have is dead letter queue (DLQ) support.

Current state: autoCreate scans the lambda event sources for SQS events. Queues are built for each event source.

Proposed state: Optionally(?) scan the resources section to see if CloudFormation templates exist for SQS. If so, generate DLQs first then add the main queues with redrive policies.

This may likely be outside the indented scope of this module. No worries if you aren’t interested in supporting it! 🤓

tclindner avatar Jun 01 '19 16:06 tclindner

Hello! Is it possible to contribute to this issue? If so, do you have any contributing guidelines?

GonzaloSaad avatar Mar 20 '21 13:03 GonzaloSaad

here's a PR to allow auto-creating queues when you don't actually want to handle those events in a lambda:

https://github.com/CoorpAcademy/serverless-plugins/pull/172/files

functions:
  doStuffAsync:
    handler: src/handlers/doStuffAsync.handler
    events:
      - sqs:
          arn:
            Fn::GetAtt:
              - FifoQueue
              - Arn
  # this is for hacking serverless-offline-sqs to auto-create the DLQ for local development
  offlineAsync:
    handler: src/handlers/offlineAsync.handler
    events:
      - sqs:
          enabled: false
          arn:
            Fn::GetAtt:
              - DeadLetterFifoQueue
              - Arn

it's a little hacky, i know, but it gets the job done

anaerobic avatar Mar 29 '21 23:03 anaerobic

Right! I did the same as a workaround, I created a "fake" consumer just to make the lib create the DLQ. I wonder why you needed to make code changes for that! I'll review the PR!

GonzaloSaad avatar Mar 30 '21 21:03 GonzaloSaad

I needed the code changes to ensure that the fake consumer handler didn't actually consume messages off of SQS, because my use case requires consuming them in a long-running process outside of the serverless stack.

anaerobic avatar Mar 30 '21 22:03 anaerobic