0

I already have implementations for sending and recieving sqs messages. The requirement is to conditionally trigger a new lambda as soon as i recieve any new meesage in sqs.

1 Answers1

0

That's very easy step. in the functions section add this . In .net core lambda below code will work

  functions:
  report-logging:
    handler: CsharpHandlers::AwsDotnetCsharp.Handler::Hello
    timeout: 30
    #provisionedConcurrency: 2
    events:
        - sqs:
            arn: arn:aws:sqs:${self:provider.region}:${self:custom.accountId}:${self:provider.stage}-callstate-api-gc-reporting
    
    # you can add packaging information here
    package:
      artifact: bin/Release/netcoreapp3.1/checkdata.zip

Below is the example in node.js using serverless.yml

#This will trigger with each SQS entry
    process-sqs-msg:
      name: ${self:service}-${self:provider.stage}-process_sqs_queue
      handler: sqs/process-msg.handler
      description: ${self:custom.gitVersion}
      timeout: 10
      memorySize: 1536
      package:
        include:
          - newrelic-lambda-wrapper.js
      events:
        - sqs:
            arn:
              Fn::GetAtt:
                - GCIdleQueue
                - Arn
      
Nouman Bhatti
  • 1,341
  • 6
  • 28
  • 54