0

So the way I understand it is that through using AmazonSQSExtendedClient, the payloads that are over 256kb will get stored into a temp bucket (see the guide here). I'm having a bit of trouble implementing this with AmazonSQSAsync. Because of the way that current system is set up, I'm currently using AmazonSQSAsync, like so:

@Bean
@Primary
AmazonSQSAsync amazonSQSAsync() {
   return AmazonSQSAsyncClientBuilder
            .standard()
            .withEndpointConfiguration(
                    new AwsClientBuilder.EndpointConfiguration(
                            endpoint_url,
                            signin_region))
            .build()
}

Now I want to replace this with the extended client to handle the payloads that are over 256kb. I have something like this so far:

@Bean
@Primary
AmazonSQS amazonSQSWithExtendedClient() {
    final AmazonS3 s3 = AmazonS3ClientBuilder.defaultClient()

    final BucketLifecycleConfiguration.Rule expirationRule =
            new BucketLifecycleConfiguration.Rule()
    expirationRule.withExpirationInDays(14).withStatus("Enabled")
    final BucketLifecycleConfiguration lifecycleConfig =
            new BucketLifecycleConfiguration().withRules(expirationRule)

    s3.setBucketLifecycleConfiguration(temp_bucket, lifecycleConfig)

    // Keep this part
    final ExtendedClientConfiguration extendedClientConfig =
            new ExtendedClientConfiguration()
                    .withLargePayloadSupportEnabled(s3, temp_bucket)

    final AmazonSQS sqsExtended = new AmazonSQSExtendedClient(AmazonSQSClientBuilder
            .standard()
            .withEndpointConfiguration(
                    new AwsClientBuilder.EndpointConfiguration(
                            endpoint_url,
                            signin_region))
            .build(), extendedClientConfig)

    return sqsExtended
}

Is there any way that I can make the extended client work with AmazonSQSAsync or at least have some workaround?

sparkhee93
  • 1,381
  • 3
  • 21
  • 30

1 Answers1

1

If you configure your JMS bean, you can solve this kind of problem. Do something like that: https://craftingjava.com/blog/large-sqs-messages-jms-spring-boot/

Victor Tripeno
  • 144
  • 1
  • 2
  • 11