spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Support for sending and receiving large message in SQS

Open vijayrcse opened this issue 1 year ago • 9 comments

Type: Feature

Is your feature request related to a problem? Please describe. We have a use case where our message size is larger than 254kb. is there a support in spring-cloud-sqs-messaging to send and receive large size messages using SQS extended client library

vijayrcse avatar Aug 04 '23 04:08 vijayrcse

Hi @vijayrcse, thanks for bringing this up.

It should be possible to send larger messages by using S3 to store the payload, and sending only the reference in the message

There's a java-extended-client-lib that has this feature built in, as described here

Unfortunately it implements the blocking SqsClient, which is not supported by the framework. It might be possible to create an adapter or wrapper to use it with the SqsTemplate.

Let me know how it works for you.

Thanks.

tomazfernandes avatar Aug 24 '23 01:08 tomazfernandes

Hello ! I am also interested. I cannot find a way to make the extended client work the spring cloud aws sqs. Can anyone provide some tips please ? Thanks in advance;

NightFox7 avatar Sep 05 '23 13:09 NightFox7

Hi @NightFox7, if anyone is interested in creating a prototype of an adapter to use the client I linked above, or a separate implementation, I'd be happy to take a look.

tomazfernandes avatar Sep 06 '23 01:09 tomazfernandes

We used SQS Extended client library to publish the message to the queue. We didn't use SQStemplate of spring cloud aws However on the consumer side, we still use the SQSListener to consumer the message as string and process. If the message size is greater than 254kb, the message will have a link to the S3 bucket. Within the listener implementation we check for a specific header( it will be only available if the message is in greater than 254 kb ) and based on that we have conditional logic to retrieve the actual message from s3 reference.

vijayrcse avatar Sep 06 '23 02:09 vijayrcse

Ok I see. Thank you @vijayrcse

NightFox7 avatar Sep 06 '23 07:09 NightFox7

@vijayrcse do you have an example of your workaround that you can share?

outcomes-josef-salyer avatar Jun 24 '24 15:06 outcomes-josef-salyer

hi @outcomes-josef-salyer , we referred only java-extended-client-lib. You will find example code snippets in AWS documentation

vijayrcse avatar Jul 22 '24 05:07 vijayrcse