powertools-lambda-java icon indicating copy to clipboard operation
powertools-lambda-java copied to clipboard

Feature request: support large payload messages received from SNS

Open qtdzz opened this issue 4 years ago • 0 comments

Is your feature request related to a problem? Please describe. Currently, @SqsLargeMessage only supports large messages which are sent directly from SQSExtendedClient, i.e: SQSExtendedClient -> SQS -> Lambda.

A common use case I've seen is subscribing the SQS to an external SNS topic where the topic could have large payload message as well, i.e. SNSExtendedClient -> SNS -> SQS -> Lambda.

Right now, the expected SQSEvent is:

{
    "records": [
        {
            "body": "[\"software.amazon.payloadoffloading.PayloadS3Pointer\",{\"s3BucketName\":\"some-bucket\",\"s3Key\":\"some-key\"}]",
            ...
        }

    ]
}

In the SNS case, the body would be a serialized string of SNSEvent.SNS class. After deserializing it, SNSEvent.SNS#getMessage() would return a PayloadS3Pointer as the current case.

Describe the solution you'd like

We could either have a flag for the current annotation or another annotation to essentially the string message of the SNS event before checking if it's a large message or not. We will need to reconstruct the SNSEvent.SNS as the body of the records though.

qtdzz avatar Nov 02 '21 07:11 qtdzz