agiledigital / serverless-sns-sqs-lambda

serverless plugin to make serverless-sns-sqs-lambda events
Apache License 2.0
81 stars 18 forks source link

Support for SQS partial batch response #667

Closed ryanwalters closed 1 year ago

ryanwalters commented 1 year ago

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!

janos-kasa commented 1 year ago

@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
NoxHarmonium commented 1 year ago

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 https://github.com/agiledigital/serverless-sns-sqs-lambda/issues/213) which is more future proof.

I'll mark this issue as solved.