agiledigital/serverless-sns-sqs-lambda

Support for SQS partial batch response

Closed this issue · 2 comments

Do you think it would be possible to add support for partial batch responses for lambdas with SQS event sources?

Here is a little more documentation on the feature, as well as the bit of CloudFormation needed to enable it.

From the Serverless plugin side of things, I defer to you to decide what is best obviously, but I picture something like this:

functions:
  processEvent:
    handler: handler.handler
    events:
      - snsSqs:
          name: TestEvent # Required - choose a name prefix for the event queue
          topicArn: !Ref Topic # Required - SNS topic to subscribe to
          reportBatchItemFailures: true # Optional - defaults to false

Great project by the way!

@ryanwalters you can do it with eventSourceMappingOverride:

functions:
  processEvent:
    handler: handler.handler
    events:
      - snsSqs:
          name: TestEvent # Required - choose a name prefix for the event queue
          topicArn: !Ref Topic # Required - SNS topic to subscribe to
          eventSourceMappingOverride:
            functionResponseTypes:
              - ReportBatchItemFailures

Thanks for your interest @ryanwalters and for your answer @janos-kasa!

@janos-kasa has the right approach, we were originally mapping through each parameter one-by-one as people found missing functionality and eventually realised that we should just directly pass through CF config for the event source mapping (a la #213) which is more future proof.

I'll mark this issue as solved.