awslabs / amazon-sqs-java-extended-client-lib

An extension to the Amazon SQS client that enables sending and receiving messages up to 2GB via Amazon S3.
Apache License 2.0
211 stars 109 forks source link

Extracted the processing of an incoming message into a public method so it can be used independently #75

Closed arshadm closed 2 years ago

arshadm commented 2 years ago

Issue #, if available: https://github.com/awslabs/amazon-sqs-java-extended-client-lib/issues/76

Description of changes: Currently the logic to handle an incoming message and download the payload is in the receiveMessage function. This is fine when the library is used to listen to messages from SQS, however if the SQS queue is used to trigger a Lambda and an extended client was used to send the message it is difficult to process it in the lambda without duplicating the code in the receiveMessage function.

This change simply extracts the handling of an incoming message into a separate public function that can be used in a lambda to handle an incoming SQS message that was triggered.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

arshadm commented 2 years ago

The powertools project handles this already - https://awslabs.github.io/aws-lambda-powertools-java/utilities/sqs_large_message_handling/