Lambda does not put message in dlq

前端 未结 2 1573
温柔的废话
温柔的废话 2021-01-27 03:35

I just trying to test my DLQ for Lambda and I do not undesrtand why messages does not put on it. My code just doing 1 thing throw new Exception(\"Test\");.

2条回答
  •  鱼传尺愫
    2021-01-27 04:22

    • Using Kinesis streams to trigger lambda means that you are using synchronous invocation. However, DLQ is only available for asynchronous invocations.
    • The good news is that in November 2019, AWS published new error handling mechanisms for Kinesis and DynamoDB event source.

    With this feature, you can configure a destination on failure. This destination can be an SNS topic, SQS queue, another lambda function, or an EventBridge event bus.

    For adding this through the console UI,

    1. Go to the lambda function
    2. Click on the Add Destination button
    3. Select Stream invocation
    4. Select on failure condition
    5. Select SQS queue as the destination and point it to the SQS that you want to use like a DLQ.

    For adding it through cloudformation, follow this documentation.
    I'll provide a basic example for the trigger that you need to attach to your lambda function:

    LambdaTrigger:
      Type: AWS::Lambda::EventSourceMapping
      Properties:
        FunctionName: !GetAtt Lambda.Arn
        EventSourceArn: !GetAtt Kinesis.Arn
        DestinationConfig:
          OnFailure:
            Destination: !GetAtt DLQ.Arn
    

提交回复
热议问题