From 23f13c690ca956e0e8da09208ca528778d245076 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 19:41:34 -0300 Subject: [PATCH 01/11] Add ack mode parameter to SqsListener annotation Fixes gh-761 --- .../AbstractCrossRegionS3Client.java | 1279 +++++++---------- ...ctListenerAnnotationBeanPostProcessor.java | 11 + .../cloud/sqs/annotation/SqsListener.java | 6 + .../SqsListenerAcknowledgmentMode.java | 54 + ...qsListenerAnnotationBeanPostProcessor.java | 2 +- .../cloud/sqs/config/SqsEndpoint.java | 18 + .../SqsMessageListenerContainerFactory.java | 3 +- .../listener/SqsContainerOptionsBuilder.java | 8 + .../sqs/integration/SqsIntegrationTests.java | 202 ++- 9 files changed, 821 insertions(+), 762 deletions(-) create mode 100644 spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java index 309a0f877..0ce55c8df 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java @@ -16,753 +16,544 @@ package io.awspring.cloud.s3.crossregion; import java.util.function.Function; +import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.exception.SdkClientException; -import software.amazon.awssdk.services.s3.S3Client; abstract class AbstractCrossRegionS3Client implements S3Client { - abstract R executeInBucketRegion(String bucket, Function fn); - - abstract R executeInDefaultRegion(Function fn); - - @Override - public String serviceName() { - return S3Client.SERVICE_NAME; - } - - @Override - public software.amazon.awssdk.services.s3.model.AbortMultipartUploadResponse abortMultipartUpload( - software.amazon.awssdk.services.s3.model.AbortMultipartUploadRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.abortMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CompleteMultipartUploadResponse completeMultipartUpload( - software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.completeMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObject( - software.amazon.awssdk.services.s3.model.CopyObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.copyObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CreateBucketResponse createBucket( - software.amazon.awssdk.services.s3.model.CreateBucketRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse createMultipartUpload( - software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketResponse deleteBucket( - software.amazon.awssdk.services.s3.model.DeleteBucketRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationResponse deleteBucketAnalyticsConfiguration( - software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketCorsResponse deleteBucketCors( - software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionResponse deleteBucketEncryption( - software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationResponse deleteBucketIntelligentTieringConfiguration( - software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationResponse deleteBucketInventoryConfiguration( - software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleResponse deleteBucketLifecycle( - software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketLifecycle(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationResponse deleteBucketMetricsConfiguration( - software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsResponse deleteBucketOwnershipControls( - software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketPolicyResponse deleteBucketPolicy( - software.amazon.awssdk.services.s3.model.DeleteBucketPolicyRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketReplicationResponse deleteBucketReplication( - software.amazon.awssdk.services.s3.model.DeleteBucketReplicationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketTaggingResponse deleteBucketTagging( - software.amazon.awssdk.services.s3.model.DeleteBucketTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteResponse deleteBucketWebsite( - software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectResponse deleteObject( - software.amazon.awssdk.services.s3.model.DeleteObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectTaggingResponse deleteObjectTagging( - software.amazon.awssdk.services.s3.model.DeleteObjectTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectsResponse deleteObjects( - software.amazon.awssdk.services.s3.model.DeleteObjectsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjects(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockResponse deletePublicAccessBlock( - software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deletePublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationResponse getBucketAccelerateConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAccelerateConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAclResponse getBucketAcl( - software.amazon.awssdk.services.s3.model.GetBucketAclRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationResponse getBucketAnalyticsConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketCorsResponse getBucketCors( - software.amazon.awssdk.services.s3.model.GetBucketCorsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketEncryptionResponse getBucketEncryption( - software.amazon.awssdk.services.s3.model.GetBucketEncryptionRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationResponse getBucketIntelligentTieringConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationResponse getBucketInventoryConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationResponse getBucketLifecycleConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLifecycleConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLocationResponse getBucketLocation( - software.amazon.awssdk.services.s3.model.GetBucketLocationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLocation(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLoggingResponse getBucketLogging( - software.amazon.awssdk.services.s3.model.GetBucketLoggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLogging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationResponse getBucketMetricsConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationResponse getBucketNotificationConfiguration( - software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketNotificationConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsResponse getBucketOwnershipControls( - software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketPolicyResponse getBucketPolicy( - software.amazon.awssdk.services.s3.model.GetBucketPolicyRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusResponse getBucketPolicyStatus( - software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicyStatus(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketReplicationResponse getBucketReplication( - software.amazon.awssdk.services.s3.model.GetBucketReplicationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentResponse getBucketRequestPayment( - software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketRequestPayment(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketTaggingResponse getBucketTagging( - software.amazon.awssdk.services.s3.model.GetBucketTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketVersioningResponse getBucketVersioning( - software.amazon.awssdk.services.s3.model.GetBucketVersioningRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketVersioning(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketWebsiteResponse getBucketWebsite( - software.amazon.awssdk.services.s3.model.GetBucketWebsiteRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseInputStream getObject( - software.amazon.awssdk.services.s3.model.GetObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject( - software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); - } - - @Override - public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, - software.amazon.awssdk.core.sync.ResponseTransformer p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectAclResponse getObjectAcl( - software.amazon.awssdk.services.s3.model.GetObjectAclRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAcl(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseBytes getObjectAsBytes( - software.amazon.awssdk.services.s3.model.GetObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAsBytes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectAttributesResponse getObjectAttributes( - software.amazon.awssdk.services.s3.model.GetObjectAttributesRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAttributes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectLegalHoldResponse getObjectLegalHold( - software.amazon.awssdk.services.s3.model.GetObjectLegalHoldRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLegalHold(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationResponse getObjectLockConfiguration( - software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLockConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectRetentionResponse getObjectRetention( - software.amazon.awssdk.services.s3.model.GetObjectRetentionRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectRetention(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectTaggingResponse getObjectTagging( - software.amazon.awssdk.services.s3.model.GetObjectTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseInputStream getObjectTorrent( - software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent( - software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); - } - - @Override - public ReturnT getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, - software.amazon.awssdk.core.sync.ResponseTransformer p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); - } - - @Override - public software.amazon.awssdk.core.ResponseBytes getObjectTorrentAsBytes( - software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrentAsBytes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetPublicAccessBlockResponse getPublicAccessBlock( - software.amazon.awssdk.services.s3.model.GetPublicAccessBlockRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getPublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.HeadBucketResponse headBucket( - software.amazon.awssdk.services.s3.model.HeadBucketRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.HeadObjectResponse headObject( - software.amazon.awssdk.services.s3.model.HeadObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsResponse listBucketAnalyticsConfigurations( - software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketAnalyticsConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsResponse listBucketIntelligentTieringConfigurations( - software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketIntelligentTieringConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsResponse listBucketInventoryConfigurations( - software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketInventoryConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsResponse listBucketMetricsConfigurations( - software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketMetricsConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketsResponse listBuckets( - software.amazon.awssdk.services.s3.model.ListBucketsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.listBuckets(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListMultipartUploadsResponse listMultipartUploads( - software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploads(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListMultipartUploadsIterable listMultipartUploadsPaginator( - software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploadsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectVersionsResponse listObjectVersions( - software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersions(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListObjectVersionsIterable listObjectVersionsPaginator( - software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersionsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectsResponse listObjects( - software.amazon.awssdk.services.s3.model.ListObjectsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjects(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectsV2Response listObjectsV2( - software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListObjectsV2Iterable listObjectsV2Paginator( - software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2Paginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListPartsResponse listParts( - software.amazon.awssdk.services.s3.model.ListPartsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listParts(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListPartsIterable listPartsPaginator( - software.amazon.awssdk.services.s3.model.ListPartsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listPartsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationResponse putBucketAccelerateConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAccelerateConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAclResponse putBucketAcl( - software.amazon.awssdk.services.s3.model.PutBucketAclRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationResponse putBucketAnalyticsConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketCorsResponse putBucketCors( - software.amazon.awssdk.services.s3.model.PutBucketCorsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketEncryptionResponse putBucketEncryption( - software.amazon.awssdk.services.s3.model.PutBucketEncryptionRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationResponse putBucketIntelligentTieringConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationResponse putBucketInventoryConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationResponse putBucketLifecycleConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLifecycleConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketLoggingResponse putBucketLogging( - software.amazon.awssdk.services.s3.model.PutBucketLoggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLogging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationResponse putBucketMetricsConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationResponse putBucketNotificationConfiguration( - software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketNotificationConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsResponse putBucketOwnershipControls( - software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketPolicyResponse putBucketPolicy( - software.amazon.awssdk.services.s3.model.PutBucketPolicyRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketReplicationResponse putBucketReplication( - software.amazon.awssdk.services.s3.model.PutBucketReplicationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentResponse putBucketRequestPayment( - software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketRequestPayment(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketTaggingResponse putBucketTagging( - software.amazon.awssdk.services.s3.model.PutBucketTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketVersioningResponse putBucketVersioning( - software.amazon.awssdk.services.s3.model.PutBucketVersioningRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketVersioning(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketWebsiteResponse putBucketWebsite( - software.amazon.awssdk.services.s3.model.PutBucketWebsiteRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject( - software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject( - software.amazon.awssdk.services.s3.model.PutObjectRequest p0, - software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectAclResponse putObjectAcl( - software.amazon.awssdk.services.s3.model.PutObjectAclRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectLegalHoldResponse putObjectLegalHold( - software.amazon.awssdk.services.s3.model.PutObjectLegalHoldRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLegalHold(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationResponse putObjectLockConfiguration( - software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLockConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectRetentionResponse putObjectRetention( - software.amazon.awssdk.services.s3.model.PutObjectRetentionRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectRetention(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectTaggingResponse putObjectTagging( - software.amazon.awssdk.services.s3.model.PutObjectTaggingRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutPublicAccessBlockResponse putPublicAccessBlock( - software.amazon.awssdk.services.s3.model.PutPublicAccessBlockRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putPublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.RestoreObjectResponse restoreObject( - software.amazon.awssdk.services.s3.model.RestoreObjectRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.restoreObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart( - software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart( - software.amazon.awssdk.services.s3.model.UploadPartRequest p0, - software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartCopyResponse uploadPartCopy( - software.amazon.awssdk.services.s3.model.UploadPartCopyRequest p0) - throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPartCopy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse( - software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, java.nio.file.Path p1) - throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse( - software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, - software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); - } + abstract R executeInBucketRegion(String bucket, Function fn); + + abstract R executeInDefaultRegion(Function fn); + + @Override + public String serviceName() { + return S3Client.SERVICE_NAME; + } + + @Override + public software.amazon.awssdk.services.s3.model.AbortMultipartUploadResponse abortMultipartUpload(software.amazon.awssdk.services.s3.model.AbortMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.abortMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CompleteMultipartUploadResponse completeMultipartUpload(software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.completeMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObject(software.amazon.awssdk.services.s3.model.CopyObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.copyObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CreateBucketResponse createBucket(software.amazon.awssdk.services.s3.model.CreateBucketRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse createMultipartUpload(software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketResponse deleteBucket(software.amazon.awssdk.services.s3.model.DeleteBucketRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationResponse deleteBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketCorsResponse deleteBucketCors(software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionResponse deleteBucketEncryption(software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationResponse deleteBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationResponse deleteBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleResponse deleteBucketLifecycle(software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketLifecycle(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationResponse deleteBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsResponse deleteBucketOwnershipControls(software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketPolicyResponse deleteBucketPolicy(software.amazon.awssdk.services.s3.model.DeleteBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketReplicationResponse deleteBucketReplication(software.amazon.awssdk.services.s3.model.DeleteBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketTaggingResponse deleteBucketTagging(software.amazon.awssdk.services.s3.model.DeleteBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteResponse deleteBucketWebsite(software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectResponse deleteObject(software.amazon.awssdk.services.s3.model.DeleteObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectTaggingResponse deleteObjectTagging(software.amazon.awssdk.services.s3.model.DeleteObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectsResponse deleteObjects(software.amazon.awssdk.services.s3.model.DeleteObjectsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjects(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockResponse deletePublicAccessBlock(software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deletePublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationResponse getBucketAccelerateConfiguration(software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAccelerateConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAclResponse getBucketAcl(software.amazon.awssdk.services.s3.model.GetBucketAclRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationResponse getBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketCorsResponse getBucketCors(software.amazon.awssdk.services.s3.model.GetBucketCorsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketEncryptionResponse getBucketEncryption(software.amazon.awssdk.services.s3.model.GetBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationResponse getBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationResponse getBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationResponse getBucketLifecycleConfiguration(software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLifecycleConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLocationResponse getBucketLocation(software.amazon.awssdk.services.s3.model.GetBucketLocationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLocation(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLoggingResponse getBucketLogging(software.amazon.awssdk.services.s3.model.GetBucketLoggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLogging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationResponse getBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationResponse getBucketNotificationConfiguration(software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketNotificationConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsResponse getBucketOwnershipControls(software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketPolicyResponse getBucketPolicy(software.amazon.awssdk.services.s3.model.GetBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusResponse getBucketPolicyStatus(software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicyStatus(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketReplicationResponse getBucketReplication(software.amazon.awssdk.services.s3.model.GetBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentResponse getBucketRequestPayment(software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketRequestPayment(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketTaggingResponse getBucketTagging(software.amazon.awssdk.services.s3.model.GetBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketVersioningResponse getBucketVersioning(software.amazon.awssdk.services.s3.model.GetBucketVersioningRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketVersioning(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketWebsiteResponse getBucketWebsite(software.amazon.awssdk.services.s3.model.GetBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseInputStream getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); + } + + @Override + public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectAclResponse getObjectAcl(software.amazon.awssdk.services.s3.model.GetObjectAclRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAcl(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseBytes getObjectAsBytes(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAsBytes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectAttributesResponse getObjectAttributes(software.amazon.awssdk.services.s3.model.GetObjectAttributesRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAttributes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectLegalHoldResponse getObjectLegalHold(software.amazon.awssdk.services.s3.model.GetObjectLegalHoldRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLegalHold(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationResponse getObjectLockConfiguration(software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLockConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectRetentionResponse getObjectRetention(software.amazon.awssdk.services.s3.model.GetObjectRetentionRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectRetention(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectTaggingResponse getObjectTagging(software.amazon.awssdk.services.s3.model.GetObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseInputStream getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); + } + + @Override + public ReturnT getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); + } + + @Override + public software.amazon.awssdk.core.ResponseBytes getObjectTorrentAsBytes(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrentAsBytes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetPublicAccessBlockResponse getPublicAccessBlock(software.amazon.awssdk.services.s3.model.GetPublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getPublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.HeadBucketResponse headBucket(software.amazon.awssdk.services.s3.model.HeadBucketRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.HeadObjectResponse headObject(software.amazon.awssdk.services.s3.model.HeadObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsResponse listBucketAnalyticsConfigurations(software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketAnalyticsConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsResponse listBucketIntelligentTieringConfigurations(software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketIntelligentTieringConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsResponse listBucketInventoryConfigurations(software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketInventoryConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsResponse listBucketMetricsConfigurations(software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketMetricsConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketsResponse listBuckets(software.amazon.awssdk.services.s3.model.ListBucketsRequest p0) throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.listBuckets(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListMultipartUploadsResponse listMultipartUploads(software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploads(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListMultipartUploadsIterable listMultipartUploadsPaginator(software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploadsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectVersionsResponse listObjectVersions(software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersions(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListObjectVersionsIterable listObjectVersionsPaginator(software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersionsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectsResponse listObjects(software.amazon.awssdk.services.s3.model.ListObjectsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjects(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectsV2Response listObjectsV2(software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListObjectsV2Iterable listObjectsV2Paginator(software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2Paginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListPartsResponse listParts(software.amazon.awssdk.services.s3.model.ListPartsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listParts(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListPartsIterable listPartsPaginator(software.amazon.awssdk.services.s3.model.ListPartsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listPartsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationResponse putBucketAccelerateConfiguration(software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAccelerateConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAclResponse putBucketAcl(software.amazon.awssdk.services.s3.model.PutBucketAclRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationResponse putBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketCorsResponse putBucketCors(software.amazon.awssdk.services.s3.model.PutBucketCorsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketEncryptionResponse putBucketEncryption(software.amazon.awssdk.services.s3.model.PutBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationResponse putBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationResponse putBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationResponse putBucketLifecycleConfiguration(software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLifecycleConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketLoggingResponse putBucketLogging(software.amazon.awssdk.services.s3.model.PutBucketLoggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLogging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationResponse putBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationResponse putBucketNotificationConfiguration(software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketNotificationConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsResponse putBucketOwnershipControls(software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketPolicyResponse putBucketPolicy(software.amazon.awssdk.services.s3.model.PutBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketReplicationResponse putBucketReplication(software.amazon.awssdk.services.s3.model.PutBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentResponse putBucketRequestPayment(software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketRequestPayment(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketTaggingResponse putBucketTagging(software.amazon.awssdk.services.s3.model.PutBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketVersioningResponse putBucketVersioning(software.amazon.awssdk.services.s3.model.PutBucketVersioningRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketVersioning(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketWebsiteResponse putBucketWebsite(software.amazon.awssdk.services.s3.model.PutBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectAclResponse putObjectAcl(software.amazon.awssdk.services.s3.model.PutObjectAclRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectLegalHoldResponse putObjectLegalHold(software.amazon.awssdk.services.s3.model.PutObjectLegalHoldRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLegalHold(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationResponse putObjectLockConfiguration(software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLockConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectRetentionResponse putObjectRetention(software.amazon.awssdk.services.s3.model.PutObjectRetentionRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectRetention(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectTaggingResponse putObjectTagging(software.amazon.awssdk.services.s3.model.PutObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutPublicAccessBlockResponse putPublicAccessBlock(software.amazon.awssdk.services.s3.model.PutPublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putPublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.RestoreObjectResponse restoreObject(software.amazon.awssdk.services.s3.model.RestoreObjectRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.restoreObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartCopyResponse uploadPartCopy(software.amazon.awssdk.services.s3.model.UploadPartCopyRequest p0) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPartCopy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse(software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse(software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); + } } + diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index f87137bd7..5a530420a 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -22,6 +22,7 @@ import io.awspring.cloud.sqs.config.HandlerMethodEndpoint; import io.awspring.cloud.sqs.config.SqsEndpoint; import io.awspring.cloud.sqs.config.SqsListenerConfigurer; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; import io.awspring.cloud.sqs.support.resolver.AcknowledgmentHandlerMethodArgumentResolver; import io.awspring.cloud.sqs.support.resolver.BatchAcknowledgmentArgumentResolver; import io.awspring.cloud.sqs.support.resolver.BatchPayloadMethodArgumentResolver; @@ -219,6 +220,16 @@ protected Integer resolveAsInteger(String value, String propertyName) { } } + @Nullable + protected AcknowledgementMode resolve(SqsListenerAcknowledgmentMode value) { + try { + return value == SqsListenerAcknowledgmentMode.INHERIT ? null : AcknowledgementMode.valueOf(value.name()); + } + catch (IllegalArgumentException e) { + throw new IllegalArgumentException("Cannot resolve " + value + " as AcknowledgementMode", e); + } + } + protected String getEndpointId(String id) { if (StringUtils.hasText(id)) { return resolveAsString(id, "id"); diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index 3ee6af09a..e2ea1c5fc 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -137,4 +137,10 @@ */ String messageVisibilitySeconds() default ""; + /** + * The acknowledgement mode to be used for the provided queues. If not specified, the acknowledgement mode defined + * for the container factory will be used. + */ + SqsListenerAcknowledgmentMode acknowledgmentMode() default SqsListenerAcknowledgmentMode.INHERIT; + } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java new file mode 100644 index 000000000..0370e03f5 --- /dev/null +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java @@ -0,0 +1,54 @@ +/* + * Copyright 2013-2023 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.awspring.cloud.sqs.annotation; + +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AlwaysAcknowledgementHandler; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.NeverAcknowledgementHandler; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.OnSuccessAcknowledgementHandler; + +/** + * Configures the acknowledgement behavior for the container. + * + * @author Joao Calassio + * @since 3.1 + * @see OnSuccessAcknowledgementHandler + * @see AlwaysAcknowledgementHandler + * @see NeverAcknowledgementHandler + * @see io.awspring.cloud.sqs.listener.ContainerOptions + * @see SqsListener + */ +public enum SqsListenerAcknowledgmentMode { + /** + * Use acknowledge mode defined by the container. + */ + INHERIT, + + /** + * Messages will be acknowledged when message processing is successful. + */ + ON_SUCCESS, + + /** + * Messages will be acknowledged whether processing was completed successfully or with an error. + */ + ALWAYS, + + /** + * Messages will not be acknowledged automatically by the container. + * @see io.awspring.cloud.sqs.listener.acknowledgement.Acknowledgement + */ + MANUAL, +} diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java index 7d695f706..48fe1231f 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java @@ -51,7 +51,7 @@ protected Endpoint createEndpoint(SqsListener sqsListenerAnnotation) { resolveAsInteger(sqsListenerAnnotation.maxConcurrentMessages(), "maxConcurrentMessages")) .messageVisibility( resolveAsInteger(sqsListenerAnnotation.messageVisibilitySeconds(), "messageVisibility")) - .build(); + .acknowledgementMode(resolve(sqsListenerAnnotation.acknowledgmentMode())).build(); } @Override diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java index 8662211b8..eb3ba7306 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java @@ -16,6 +16,7 @@ package io.awspring.cloud.sqs.config; import io.awspring.cloud.sqs.annotation.SqsListener; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; import java.time.Duration; import java.util.Collection; import org.springframework.lang.Nullable; @@ -38,12 +39,16 @@ public class SqsEndpoint extends AbstractEndpoint { private final Integer maxMessagesPerPoll; + @Nullable + private final AcknowledgementMode acknowledgementMode; + protected SqsEndpoint(SqsEndpointBuilder builder) { super(builder.queueNames, builder.factoryName, builder.id); this.maxConcurrentMessages = builder.maxConcurrentMessages; this.pollTimeoutSeconds = builder.pollTimeoutSeconds; this.messageVisibility = builder.messageVisibility; this.maxMessagesPerPoll = builder.maxMessagesPerPoll; + this.acknowledgementMode = builder.acknowledgementMode; } /** @@ -91,6 +96,11 @@ public Duration getMessageVisibility() { return this.messageVisibility != null ? Duration.ofSeconds(this.messageVisibility) : null; } + @Nullable + public AcknowledgementMode getAcknowledgementMode() { + return this.acknowledgementMode; + } + public static class SqsEndpointBuilder { private Collection queueNames; @@ -107,6 +117,9 @@ public static class SqsEndpointBuilder { private Integer maxMessagesPerPoll; + @Nullable + private AcknowledgementMode acknowledgementMode; + public SqsEndpointBuilder queueNames(Collection queueNames) { this.queueNames = queueNames; return this; @@ -142,6 +155,11 @@ public SqsEndpointBuilder id(String id) { return this; } + public SqsEndpointBuilder acknowledgementMode(@Nullable AcknowledgementMode acknowledgementMode) { + this.acknowledgementMode = acknowledgementMode; + return this; + } + public SqsEndpoint build() { return new SqsEndpoint(this); } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java index 85f03c11c..d001a25d7 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java @@ -161,7 +161,8 @@ private void configureFromSqsEndpoint(SqsEndpoint sqsEndpoint, SqsContainerOptio ConfigUtils.INSTANCE.acceptIfNotNull(sqsEndpoint.getMaxConcurrentMessages(), options::maxConcurrentMessages) .acceptIfNotNull(sqsEndpoint.getMaxMessagesPerPoll(), options::maxMessagesPerPoll) .acceptIfNotNull(sqsEndpoint.getPollTimeout(), options::pollTimeout) - .acceptIfNotNull(sqsEndpoint.getMessageVisibility(), options::messageVisibility); + .acceptIfNotNull(sqsEndpoint.getMessageVisibility(), options::messageVisibility) + .acceptIfNotNull(sqsEndpoint.getAcknowledgementMode(), options::acknowledgementMode); } /** diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java index f52f562e3..7b1388564 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java @@ -15,6 +15,7 @@ */ package io.awspring.cloud.sqs.listener; +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; import java.time.Duration; import java.util.Collection; import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName; @@ -65,4 +66,11 @@ SqsContainerOptionsBuilder messageSystemAttributeNames( */ SqsContainerOptionsBuilder queueNotFoundStrategy(QueueNotFoundStrategy queueNotFoundStrategy); + /** + * Set the {@link AcknowledgementMode} for the container. + * @param acknowledgementMode the acknowledgement mode. + * @return this instance. + */ + SqsContainerOptionsBuilder acknowledgementMode(AcknowledgementMode acknowledgementMode); + } diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java index 6141dae0b..698c2eb99 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java @@ -16,6 +16,7 @@ package io.awspring.cloud.sqs.integration; import static java.util.Collections.singletonMap; +import static java.util.Map.entry; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; @@ -23,6 +24,7 @@ import io.awspring.cloud.sqs.CompletableFutures; import io.awspring.cloud.sqs.MessageHeaderUtils; import io.awspring.cloud.sqs.annotation.SqsListener; +import io.awspring.cloud.sqs.annotation.SqsListenerAcknowledgmentMode; import io.awspring.cloud.sqs.config.SqsBootstrapConfiguration; import io.awspring.cloud.sqs.config.SqsListenerConfigurer; import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; @@ -49,11 +51,7 @@ import io.awspring.cloud.sqs.operations.SqsTemplate; import java.lang.reflect.Method; import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.UUID; +import java.util.*; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CompletableFuture; import java.util.concurrent.CountDownLatch; @@ -130,6 +128,16 @@ class SqsIntegrationTests extends BaseSqsIntegrationTest { static final String ACK_AFTER_SECOND_ERROR_FACTORY = "ackAfterSecondErrorFactory"; + static final String ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME = "annotation_always_ack_success_test_queue"; + + static final String ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME = "annotation_always_ack_error_test_queue"; + + static final String ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME = "annotation_on_success_ack_success_test_queue"; + + static final String ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME = "annotation_on_success_ack_error_test_queue"; + + static final String ANNOTATION_MANUAL_ACK_QUEUE_NAME = "annotation_ack_manual_test_queue"; + @BeforeAll static void beforeTests() { SqsAsyncClient client = createAsyncClient(); @@ -149,7 +157,13 @@ static void beforeTests() { createQueue(client, MANUALLY_CREATE_CONTAINER_QUEUE_NAME), createQueue(client, MANUALLY_CREATE_INACTIVE_CONTAINER_QUEUE_NAME), createQueue(client, MANUALLY_CREATE_FACTORY_QUEUE_NAME), - createQueue(client, MAX_CONCURRENT_MESSAGES_QUEUE_NAME)).join(); + createQueue(client, MAX_CONCURRENT_MESSAGES_QUEUE_NAME), + createQueue(client, ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME), + createQueue(client, ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME), + createQueue(client, ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME), + createQueue(client, ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + singletonMap(QueueAttributeName.VISIBILITY_TIMEOUT, "1")), + createQueue(client, ANNOTATION_MANUAL_ACK_QUEUE_NAME)).join(); } @Autowired @@ -231,6 +245,52 @@ void doesNotAckOnErrorBatchAsync() throws Exception { assertThat(latchContainer.doesNotAckBatchAsyncLatch.await(10, TimeUnit.SECONDS)).isTrue(); } + @Test + void annotationAlwaysAckOnSuccess() throws Exception { + String messageBody = "annotationAlwaysAckOnSuccess-payload"; + sqsTemplate.send(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationAlwaysAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationAlwaysAckOnError() throws Exception { + String messageBody = "annotationAlwaysAckOnError-payload"; + sqsTemplate.send(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationAlwaysAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationOnSuccessAckOnSuccess() throws Exception { + String messageBody = "annotationOnSuccessAckOnSuccess-payload"; + sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationOnSuccessAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationOnSuccessAckOnError() throws Exception { + String messageBody = "annotationOnSuccessAckOnError-payload"; + sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationOnSuccessAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(latchContainer.annotationOnSuccessAckErrorCallbackLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationManualAck() throws Exception { + String messageBody = "annotationManualAck-payload"; + sqsTemplate.send(ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); + assertThat(latchContainer.annotationManualAckLatch.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(latchContainer.annotationManualAckLatchCallback.await(10, TimeUnit.SECONDS)).isFalse(); + } + @Test void resolvesManyParameterTypes() throws Exception { String messageBody = "many-parameter-types-payload"; @@ -451,6 +511,65 @@ void listen(String message) throws BrokenBarrierException, InterruptedException } } + static class AnnotationAlwaysAcknowledgeOnSuccessMessagesListener { + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationAlwaysAckSuccessLatch.countDown(); + } + } + + static class AnnotationAlwaysAcknowledgeOnErrorMessagesListener { + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationAlwaysAckErrorLatch.countDown(); + throw new RuntimeException("Expected exception from annotation-ack-always-error"); + } + } + + static class AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener { + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationOnSuccessAckSuccessLatch.countDown(); + } + } + + static class AnnotationOnSuccessAcknowledgeOnErrorMessagesListener { + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationOnSuccessAckErrorLatch.countDown(); + throw new RuntimeException("Expected exception from annotation-onsuccess-ack-error"); + } + } + + static class AnnotationManualAcknowledgeMessagesListener { + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", acknowledgmentMode = SqsListenerAcknowledgmentMode.MANUAL) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationManualAckLatch.countDown(); + } + } + + // add message listners for manual ack modes + static class LatchContainer { final CountDownLatch receivesMessageLatch = new CountDownLatch(1); @@ -475,7 +594,13 @@ static class LatchContainer { final CountDownLatch acknowledgementCallbackErrorLatch = new CountDownLatch(1); final CountDownLatch manuallyInactiveCreatedContainerLatch = new CountDownLatch(1); final CyclicBarrier maxConcurrentMessagesBarrier = new CyclicBarrier(21); - + final CountDownLatch annotationAlwaysAckSuccessLatch = new CountDownLatch(2); + final CountDownLatch annotationAlwaysAckErrorLatch = new CountDownLatch(2); + final CountDownLatch annotationOnSuccessAckSuccessLatch = new CountDownLatch(2); + final CountDownLatch annotationOnSuccessAckErrorLatch = new CountDownLatch(1); + final CountDownLatch annotationOnSuccessAckErrorCallbackLatch = new CountDownLatch(1); + final CountDownLatch annotationManualAckLatch = new CountDownLatch(1); + final CountDownLatch annotationManualAckLatchCallback = new CountDownLatch(1); } @Import(SqsBootstrapConfiguration.class) @@ -543,10 +668,11 @@ protected AcknowledgementExecutor createAcknowledgementExecutorInstance( @Override public CompletableFuture execute(Collection> messagesToAck) { - if (MessageHeaderUtils - .getHeaderAsString(messagesToAck.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER).equals(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME) + final String queueName = MessageHeaderUtils + .getHeaderAsString(messagesToAck.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER); + if ((queueName.equals(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME) || queueName.equals(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME)) && hasThrown.compareAndSet(false, true)) { - return CompletableFutures.failedFuture(new RuntimeException("Expected acknowledgement exception for " + DOES_NOT_ACK_ON_ERROR_QUEUE_NAME)); + return CompletableFutures.failedFuture(new RuntimeException("Expected acknowledgement exception for " + queueName)); } return super.execute(messagesToAck); } @@ -678,6 +804,31 @@ DoesNotAckOnErrorAsyncBatchListener doesNotAckOnErrorAsyncBatchListener() { return new DoesNotAckOnErrorAsyncBatchListener(); } + @Bean + AnnotationAlwaysAcknowledgeOnSuccessMessagesListener annotationAlwaysAcknowledgeOnSuccessMessagesListener() { + return new AnnotationAlwaysAcknowledgeOnSuccessMessagesListener(); + } + + @Bean + AnnotationAlwaysAcknowledgeOnErrorMessagesListener annotationAlwaysAcknowledgeOnErrorMessagesListener() { + return new AnnotationAlwaysAcknowledgeOnErrorMessagesListener(); + } + + @Bean + AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener annotationOnSuccessAcknowledgeOnSuccessMessagesListener() { + return new AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener(); + } + + @Bean + AnnotationOnSuccessAcknowledgeOnErrorMessagesListener annotationOnSuccessAcknowledgeOnErrorMessagesListener() { + return new AnnotationOnSuccessAcknowledgeOnErrorMessagesListener(); + } + + @Bean + AnnotationManualAcknowledgeMessagesListener annotationManualAcknowledgeMessagesListener() { + return new AnnotationManualAcknowledgeMessagesListener(); + } + @Bean ResolvesParameterTypesListener resolvesParameterTypesListener() { return new ResolvesParameterTypesListener(); @@ -775,19 +926,38 @@ private AcknowledgementResultCallback getAcknowledgementResultCallback() public void onSuccess(Collection> messages) { logger.debug("Invoking on success acknowledgement result callback for {}", MessageHeaderUtils.getId(messages)); - if (RECEIVES_MESSAGE_QUEUE_NAME.equals(MessageHeaderUtils - .getHeaderAsString(messages.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER))) { - latchContainer.acknowledgementCallbackSuccessLatch.countDown(); + final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), + SqsHeaders.SQS_QUEUE_NAME_HEADER); + + final Map latches = Map.ofEntries( + entry(RECEIVES_MESSAGE_QUEUE_NAME, latchContainer.acknowledgementCallbackSuccessLatch), + entry(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, latchContainer.annotationAlwaysAckSuccessLatch), + entry(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationAlwaysAckErrorLatch), + entry(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, latchContainer.annotationOnSuccessAckSuccessLatch), + entry(ANNOTATION_MANUAL_ACK_QUEUE_NAME, latchContainer.annotationManualAckLatchCallback) + ); + + if (latches.containsKey(queueName)) { + latches.get(queueName).countDown(); } + + } @Override public void onFailure(Collection> messages, Throwable t) { logger.debug("Invoking on failure acknowledgement result callback for {}", MessageHeaderUtils.getId(messages)); - if (DOES_NOT_ACK_ON_ERROR_QUEUE_NAME.equals(MessageHeaderUtils - .getHeaderAsString(messages.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER))) { - latchContainer.acknowledgementCallbackErrorLatch.countDown(); + final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), + SqsHeaders.SQS_QUEUE_NAME_HEADER); + + final Map latches = Map.ofEntries( + entry(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME, latchContainer.acknowledgementCallbackErrorLatch), + entry(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationOnSuccessAckErrorCallbackLatch) + ); + + if (latches.containsKey(queueName)) { + latches.get(queueName).countDown(); } } }; From ab4869138df2850b54e6c9212df5fbd541c50150 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 19:45:55 -0300 Subject: [PATCH 02/11] Remove unrelated file from PR --- .../AbstractCrossRegionS3Client.java | 1279 ++++++++++------- 1 file changed, 744 insertions(+), 535 deletions(-) diff --git a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java index 0ce55c8df..309a0f877 100644 --- a/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java +++ b/spring-cloud-aws-s3-parent/spring-cloud-aws-s3-cross-region-client/src/main/java/io/awspring/cloud/s3/crossregion/AbstractCrossRegionS3Client.java @@ -16,544 +16,753 @@ package io.awspring.cloud.s3.crossregion; import java.util.function.Function; -import software.amazon.awssdk.services.s3.S3Client; import software.amazon.awssdk.awscore.exception.AwsServiceException; import software.amazon.awssdk.core.exception.SdkClientException; +import software.amazon.awssdk.services.s3.S3Client; abstract class AbstractCrossRegionS3Client implements S3Client { - abstract R executeInBucketRegion(String bucket, Function fn); - - abstract R executeInDefaultRegion(Function fn); - - @Override - public String serviceName() { - return S3Client.SERVICE_NAME; - } - - @Override - public software.amazon.awssdk.services.s3.model.AbortMultipartUploadResponse abortMultipartUpload(software.amazon.awssdk.services.s3.model.AbortMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.abortMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CompleteMultipartUploadResponse completeMultipartUpload(software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.completeMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObject(software.amazon.awssdk.services.s3.model.CopyObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.copyObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CreateBucketResponse createBucket(software.amazon.awssdk.services.s3.model.CreateBucketRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse createMultipartUpload(software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createMultipartUpload(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketResponse deleteBucket(software.amazon.awssdk.services.s3.model.DeleteBucketRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationResponse deleteBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketCorsResponse deleteBucketCors(software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionResponse deleteBucketEncryption(software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationResponse deleteBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationResponse deleteBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleResponse deleteBucketLifecycle(software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketLifecycle(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationResponse deleteBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsResponse deleteBucketOwnershipControls(software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketPolicyResponse deleteBucketPolicy(software.amazon.awssdk.services.s3.model.DeleteBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketReplicationResponse deleteBucketReplication(software.amazon.awssdk.services.s3.model.DeleteBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketTaggingResponse deleteBucketTagging(software.amazon.awssdk.services.s3.model.DeleteBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteResponse deleteBucketWebsite(software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectResponse deleteObject(software.amazon.awssdk.services.s3.model.DeleteObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectTaggingResponse deleteObjectTagging(software.amazon.awssdk.services.s3.model.DeleteObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeleteObjectsResponse deleteObjects(software.amazon.awssdk.services.s3.model.DeleteObjectsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjects(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockResponse deletePublicAccessBlock(software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deletePublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationResponse getBucketAccelerateConfiguration(software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAccelerateConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAclResponse getBucketAcl(software.amazon.awssdk.services.s3.model.GetBucketAclRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationResponse getBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketCorsResponse getBucketCors(software.amazon.awssdk.services.s3.model.GetBucketCorsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketEncryptionResponse getBucketEncryption(software.amazon.awssdk.services.s3.model.GetBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationResponse getBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationResponse getBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationResponse getBucketLifecycleConfiguration(software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLifecycleConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLocationResponse getBucketLocation(software.amazon.awssdk.services.s3.model.GetBucketLocationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLocation(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketLoggingResponse getBucketLogging(software.amazon.awssdk.services.s3.model.GetBucketLoggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLogging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationResponse getBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationResponse getBucketNotificationConfiguration(software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketNotificationConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsResponse getBucketOwnershipControls(software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketPolicyResponse getBucketPolicy(software.amazon.awssdk.services.s3.model.GetBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusResponse getBucketPolicyStatus(software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicyStatus(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketReplicationResponse getBucketReplication(software.amazon.awssdk.services.s3.model.GetBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentResponse getBucketRequestPayment(software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketRequestPayment(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketTaggingResponse getBucketTagging(software.amazon.awssdk.services.s3.model.GetBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketVersioningResponse getBucketVersioning(software.amazon.awssdk.services.s3.model.GetBucketVersioningRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketVersioning(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetBucketWebsiteResponse getBucketWebsite(software.amazon.awssdk.services.s3.model.GetBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseInputStream getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); - } - - @Override - public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectAclResponse getObjectAcl(software.amazon.awssdk.services.s3.model.GetObjectAclRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAcl(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseBytes getObjectAsBytes(software.amazon.awssdk.services.s3.model.GetObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAsBytes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectAttributesResponse getObjectAttributes(software.amazon.awssdk.services.s3.model.GetObjectAttributesRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAttributes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectLegalHoldResponse getObjectLegalHold(software.amazon.awssdk.services.s3.model.GetObjectLegalHoldRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLegalHold(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationResponse getObjectLockConfiguration(software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLockConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectRetentionResponse getObjectRetention(software.amazon.awssdk.services.s3.model.GetObjectRetentionRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectRetention(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectTaggingResponse getObjectTagging(software.amazon.awssdk.services.s3.model.GetObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.core.ResponseInputStream getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); - } - - @Override - public ReturnT getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, software.amazon.awssdk.core.sync.ResponseTransformer p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); - } - - @Override - public software.amazon.awssdk.core.ResponseBytes getObjectTorrentAsBytes(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrentAsBytes(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.GetPublicAccessBlockResponse getPublicAccessBlock(software.amazon.awssdk.services.s3.model.GetPublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getPublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.HeadBucketResponse headBucket(software.amazon.awssdk.services.s3.model.HeadBucketRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headBucket(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.HeadObjectResponse headObject(software.amazon.awssdk.services.s3.model.HeadObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsResponse listBucketAnalyticsConfigurations(software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketAnalyticsConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsResponse listBucketIntelligentTieringConfigurations(software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketIntelligentTieringConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsResponse listBucketInventoryConfigurations(software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketInventoryConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsResponse listBucketMetricsConfigurations(software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketMetricsConfigurations(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListBucketsResponse listBuckets(software.amazon.awssdk.services.s3.model.ListBucketsRequest p0) throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.listBuckets(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListMultipartUploadsResponse listMultipartUploads(software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploads(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListMultipartUploadsIterable listMultipartUploadsPaginator(software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploadsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectVersionsResponse listObjectVersions(software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersions(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListObjectVersionsIterable listObjectVersionsPaginator(software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersionsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectsResponse listObjects(software.amazon.awssdk.services.s3.model.ListObjectsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjects(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListObjectsV2Response listObjectsV2(software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListObjectsV2Iterable listObjectsV2Paginator(software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2Paginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.ListPartsResponse listParts(software.amazon.awssdk.services.s3.model.ListPartsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listParts(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.paginators.ListPartsIterable listPartsPaginator(software.amazon.awssdk.services.s3.model.ListPartsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listPartsPaginator(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationResponse putBucketAccelerateConfiguration(software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAccelerateConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAclResponse putBucketAcl(software.amazon.awssdk.services.s3.model.PutBucketAclRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationResponse putBucketAnalyticsConfiguration(software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAnalyticsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketCorsResponse putBucketCors(software.amazon.awssdk.services.s3.model.PutBucketCorsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketCors(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketEncryptionResponse putBucketEncryption(software.amazon.awssdk.services.s3.model.PutBucketEncryptionRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketEncryption(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationResponse putBucketIntelligentTieringConfiguration(software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketIntelligentTieringConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationResponse putBucketInventoryConfiguration(software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketInventoryConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationResponse putBucketLifecycleConfiguration(software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLifecycleConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketLoggingResponse putBucketLogging(software.amazon.awssdk.services.s3.model.PutBucketLoggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLogging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationResponse putBucketMetricsConfiguration(software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketMetricsConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationResponse putBucketNotificationConfiguration(software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketNotificationConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsResponse putBucketOwnershipControls(software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketOwnershipControls(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketPolicyResponse putBucketPolicy(software.amazon.awssdk.services.s3.model.PutBucketPolicyRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketPolicy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketReplicationResponse putBucketReplication(software.amazon.awssdk.services.s3.model.PutBucketReplicationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketReplication(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentResponse putBucketRequestPayment(software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketRequestPayment(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketTaggingResponse putBucketTagging(software.amazon.awssdk.services.s3.model.PutBucketTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketVersioningResponse putBucketVersioning(software.amazon.awssdk.services.s3.model.PutBucketVersioningRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketVersioning(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutBucketWebsiteResponse putBucketWebsite(software.amazon.awssdk.services.s3.model.PutBucketWebsiteRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketWebsite(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject(software.amazon.awssdk.services.s3.model.PutObjectRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectAclResponse putObjectAcl(software.amazon.awssdk.services.s3.model.PutObjectAclRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectAcl(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectLegalHoldResponse putObjectLegalHold(software.amazon.awssdk.services.s3.model.PutObjectLegalHoldRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLegalHold(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationResponse putObjectLockConfiguration(software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLockConfiguration(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectRetentionResponse putObjectRetention(software.amazon.awssdk.services.s3.model.PutObjectRetentionRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectRetention(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutObjectTaggingResponse putObjectTagging(software.amazon.awssdk.services.s3.model.PutObjectTaggingRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectTagging(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.PutPublicAccessBlockResponse putPublicAccessBlock(software.amazon.awssdk.services.s3.model.PutPublicAccessBlockRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putPublicAccessBlock(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.RestoreObjectResponse restoreObject(software.amazon.awssdk.services.s3.model.RestoreObjectRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.restoreObject(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart(software.amazon.awssdk.services.s3.model.UploadPartRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.UploadPartCopyResponse uploadPartCopy(software.amazon.awssdk.services.s3.model.UploadPartCopyRequest p0) throws AwsServiceException, SdkClientException { - return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPartCopy(p0)); - } - - @Override - public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse(software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, java.nio.file.Path p1) throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); - } - - @Override - public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse(software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { - return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); - } + abstract R executeInBucketRegion(String bucket, Function fn); + + abstract R executeInDefaultRegion(Function fn); + + @Override + public String serviceName() { + return S3Client.SERVICE_NAME; + } + + @Override + public software.amazon.awssdk.services.s3.model.AbortMultipartUploadResponse abortMultipartUpload( + software.amazon.awssdk.services.s3.model.AbortMultipartUploadRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.abortMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CompleteMultipartUploadResponse completeMultipartUpload( + software.amazon.awssdk.services.s3.model.CompleteMultipartUploadRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.completeMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CopyObjectResponse copyObject( + software.amazon.awssdk.services.s3.model.CopyObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.copyObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CreateBucketResponse createBucket( + software.amazon.awssdk.services.s3.model.CreateBucketRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.CreateMultipartUploadResponse createMultipartUpload( + software.amazon.awssdk.services.s3.model.CreateMultipartUploadRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.createMultipartUpload(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketResponse deleteBucket( + software.amazon.awssdk.services.s3.model.DeleteBucketRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationResponse deleteBucketAnalyticsConfiguration( + software.amazon.awssdk.services.s3.model.DeleteBucketAnalyticsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketCorsResponse deleteBucketCors( + software.amazon.awssdk.services.s3.model.DeleteBucketCorsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionResponse deleteBucketEncryption( + software.amazon.awssdk.services.s3.model.DeleteBucketEncryptionRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationResponse deleteBucketIntelligentTieringConfiguration( + software.amazon.awssdk.services.s3.model.DeleteBucketIntelligentTieringConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationResponse deleteBucketInventoryConfiguration( + software.amazon.awssdk.services.s3.model.DeleteBucketInventoryConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleResponse deleteBucketLifecycle( + software.amazon.awssdk.services.s3.model.DeleteBucketLifecycleRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketLifecycle(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationResponse deleteBucketMetricsConfiguration( + software.amazon.awssdk.services.s3.model.DeleteBucketMetricsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsResponse deleteBucketOwnershipControls( + software.amazon.awssdk.services.s3.model.DeleteBucketOwnershipControlsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketPolicyResponse deleteBucketPolicy( + software.amazon.awssdk.services.s3.model.DeleteBucketPolicyRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketReplicationResponse deleteBucketReplication( + software.amazon.awssdk.services.s3.model.DeleteBucketReplicationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketTaggingResponse deleteBucketTagging( + software.amazon.awssdk.services.s3.model.DeleteBucketTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteResponse deleteBucketWebsite( + software.amazon.awssdk.services.s3.model.DeleteBucketWebsiteRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectResponse deleteObject( + software.amazon.awssdk.services.s3.model.DeleteObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectTaggingResponse deleteObjectTagging( + software.amazon.awssdk.services.s3.model.DeleteObjectTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeleteObjectsResponse deleteObjects( + software.amazon.awssdk.services.s3.model.DeleteObjectsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deleteObjects(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockResponse deletePublicAccessBlock( + software.amazon.awssdk.services.s3.model.DeletePublicAccessBlockRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.deletePublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationResponse getBucketAccelerateConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketAccelerateConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAccelerateConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAclResponse getBucketAcl( + software.amazon.awssdk.services.s3.model.GetBucketAclRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationResponse getBucketAnalyticsConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketAnalyticsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketCorsResponse getBucketCors( + software.amazon.awssdk.services.s3.model.GetBucketCorsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketEncryptionResponse getBucketEncryption( + software.amazon.awssdk.services.s3.model.GetBucketEncryptionRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationResponse getBucketIntelligentTieringConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketIntelligentTieringConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationResponse getBucketInventoryConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketInventoryConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationResponse getBucketLifecycleConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketLifecycleConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLifecycleConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLocationResponse getBucketLocation( + software.amazon.awssdk.services.s3.model.GetBucketLocationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLocation(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketLoggingResponse getBucketLogging( + software.amazon.awssdk.services.s3.model.GetBucketLoggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketLogging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationResponse getBucketMetricsConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketMetricsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationResponse getBucketNotificationConfiguration( + software.amazon.awssdk.services.s3.model.GetBucketNotificationConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketNotificationConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsResponse getBucketOwnershipControls( + software.amazon.awssdk.services.s3.model.GetBucketOwnershipControlsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketPolicyResponse getBucketPolicy( + software.amazon.awssdk.services.s3.model.GetBucketPolicyRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusResponse getBucketPolicyStatus( + software.amazon.awssdk.services.s3.model.GetBucketPolicyStatusRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketPolicyStatus(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketReplicationResponse getBucketReplication( + software.amazon.awssdk.services.s3.model.GetBucketReplicationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentResponse getBucketRequestPayment( + software.amazon.awssdk.services.s3.model.GetBucketRequestPaymentRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketRequestPayment(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketTaggingResponse getBucketTagging( + software.amazon.awssdk.services.s3.model.GetBucketTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketVersioningResponse getBucketVersioning( + software.amazon.awssdk.services.s3.model.GetBucketVersioningRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketVersioning(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetBucketWebsiteResponse getBucketWebsite( + software.amazon.awssdk.services.s3.model.GetBucketWebsiteRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseInputStream getObject( + software.amazon.awssdk.services.s3.model.GetObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectResponse getObject( + software.amazon.awssdk.services.s3.model.GetObjectRequest p0, java.nio.file.Path p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); + } + + @Override + public ReturnT getObject(software.amazon.awssdk.services.s3.model.GetObjectRequest p0, + software.amazon.awssdk.core.sync.ResponseTransformer p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectAclResponse getObjectAcl( + software.amazon.awssdk.services.s3.model.GetObjectAclRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAcl(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseBytes getObjectAsBytes( + software.amazon.awssdk.services.s3.model.GetObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAsBytes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectAttributesResponse getObjectAttributes( + software.amazon.awssdk.services.s3.model.GetObjectAttributesRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectAttributes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectLegalHoldResponse getObjectLegalHold( + software.amazon.awssdk.services.s3.model.GetObjectLegalHoldRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLegalHold(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationResponse getObjectLockConfiguration( + software.amazon.awssdk.services.s3.model.GetObjectLockConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectLockConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectRetentionResponse getObjectRetention( + software.amazon.awssdk.services.s3.model.GetObjectRetentionRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectRetention(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectTaggingResponse getObjectTagging( + software.amazon.awssdk.services.s3.model.GetObjectTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.core.ResponseInputStream getObjectTorrent( + software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetObjectTorrentResponse getObjectTorrent( + software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, java.nio.file.Path p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); + } + + @Override + public ReturnT getObjectTorrent(software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0, + software.amazon.awssdk.core.sync.ResponseTransformer p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrent(p0, p1)); + } + + @Override + public software.amazon.awssdk.core.ResponseBytes getObjectTorrentAsBytes( + software.amazon.awssdk.services.s3.model.GetObjectTorrentRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getObjectTorrentAsBytes(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.GetPublicAccessBlockResponse getPublicAccessBlock( + software.amazon.awssdk.services.s3.model.GetPublicAccessBlockRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.getPublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.HeadBucketResponse headBucket( + software.amazon.awssdk.services.s3.model.HeadBucketRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headBucket(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.HeadObjectResponse headObject( + software.amazon.awssdk.services.s3.model.HeadObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.headObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsResponse listBucketAnalyticsConfigurations( + software.amazon.awssdk.services.s3.model.ListBucketAnalyticsConfigurationsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketAnalyticsConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsResponse listBucketIntelligentTieringConfigurations( + software.amazon.awssdk.services.s3.model.ListBucketIntelligentTieringConfigurationsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketIntelligentTieringConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsResponse listBucketInventoryConfigurations( + software.amazon.awssdk.services.s3.model.ListBucketInventoryConfigurationsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketInventoryConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsResponse listBucketMetricsConfigurations( + software.amazon.awssdk.services.s3.model.ListBucketMetricsConfigurationsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listBucketMetricsConfigurations(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListBucketsResponse listBuckets( + software.amazon.awssdk.services.s3.model.ListBucketsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.listBuckets(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListMultipartUploadsResponse listMultipartUploads( + software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploads(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListMultipartUploadsIterable listMultipartUploadsPaginator( + software.amazon.awssdk.services.s3.model.ListMultipartUploadsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listMultipartUploadsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectVersionsResponse listObjectVersions( + software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersions(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListObjectVersionsIterable listObjectVersionsPaginator( + software.amazon.awssdk.services.s3.model.ListObjectVersionsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectVersionsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectsResponse listObjects( + software.amazon.awssdk.services.s3.model.ListObjectsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjects(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListObjectsV2Response listObjectsV2( + software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListObjectsV2Iterable listObjectsV2Paginator( + software.amazon.awssdk.services.s3.model.ListObjectsV2Request p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listObjectsV2Paginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.ListPartsResponse listParts( + software.amazon.awssdk.services.s3.model.ListPartsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listParts(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.paginators.ListPartsIterable listPartsPaginator( + software.amazon.awssdk.services.s3.model.ListPartsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.listPartsPaginator(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationResponse putBucketAccelerateConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketAccelerateConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAccelerateConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAclResponse putBucketAcl( + software.amazon.awssdk.services.s3.model.PutBucketAclRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationResponse putBucketAnalyticsConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketAnalyticsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketAnalyticsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketCorsResponse putBucketCors( + software.amazon.awssdk.services.s3.model.PutBucketCorsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketCors(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketEncryptionResponse putBucketEncryption( + software.amazon.awssdk.services.s3.model.PutBucketEncryptionRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketEncryption(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationResponse putBucketIntelligentTieringConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketIntelligentTieringConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketIntelligentTieringConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationResponse putBucketInventoryConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketInventoryConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketInventoryConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationResponse putBucketLifecycleConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketLifecycleConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLifecycleConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketLoggingResponse putBucketLogging( + software.amazon.awssdk.services.s3.model.PutBucketLoggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketLogging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationResponse putBucketMetricsConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketMetricsConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketMetricsConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationResponse putBucketNotificationConfiguration( + software.amazon.awssdk.services.s3.model.PutBucketNotificationConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketNotificationConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsResponse putBucketOwnershipControls( + software.amazon.awssdk.services.s3.model.PutBucketOwnershipControlsRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketOwnershipControls(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketPolicyResponse putBucketPolicy( + software.amazon.awssdk.services.s3.model.PutBucketPolicyRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketPolicy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketReplicationResponse putBucketReplication( + software.amazon.awssdk.services.s3.model.PutBucketReplicationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketReplication(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentResponse putBucketRequestPayment( + software.amazon.awssdk.services.s3.model.PutBucketRequestPaymentRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketRequestPayment(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketTaggingResponse putBucketTagging( + software.amazon.awssdk.services.s3.model.PutBucketTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketVersioningResponse putBucketVersioning( + software.amazon.awssdk.services.s3.model.PutBucketVersioningRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketVersioning(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutBucketWebsiteResponse putBucketWebsite( + software.amazon.awssdk.services.s3.model.PutBucketWebsiteRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putBucketWebsite(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject( + software.amazon.awssdk.services.s3.model.PutObjectRequest p0, java.nio.file.Path p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectResponse putObject( + software.amazon.awssdk.services.s3.model.PutObjectRequest p0, + software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObject(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectAclResponse putObjectAcl( + software.amazon.awssdk.services.s3.model.PutObjectAclRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectAcl(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectLegalHoldResponse putObjectLegalHold( + software.amazon.awssdk.services.s3.model.PutObjectLegalHoldRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLegalHold(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationResponse putObjectLockConfiguration( + software.amazon.awssdk.services.s3.model.PutObjectLockConfigurationRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectLockConfiguration(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectRetentionResponse putObjectRetention( + software.amazon.awssdk.services.s3.model.PutObjectRetentionRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectRetention(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutObjectTaggingResponse putObjectTagging( + software.amazon.awssdk.services.s3.model.PutObjectTaggingRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putObjectTagging(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.PutPublicAccessBlockResponse putPublicAccessBlock( + software.amazon.awssdk.services.s3.model.PutPublicAccessBlockRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.putPublicAccessBlock(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.RestoreObjectResponse restoreObject( + software.amazon.awssdk.services.s3.model.RestoreObjectRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.restoreObject(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart( + software.amazon.awssdk.services.s3.model.UploadPartRequest p0, java.nio.file.Path p1) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartResponse uploadPart( + software.amazon.awssdk.services.s3.model.UploadPartRequest p0, + software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPart(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.UploadPartCopyResponse uploadPartCopy( + software.amazon.awssdk.services.s3.model.UploadPartCopyRequest p0) + throws AwsServiceException, SdkClientException { + return executeInBucketRegion(p0.bucket(), s3Client -> s3Client.uploadPartCopy(p0)); + } + + @Override + public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse( + software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, java.nio.file.Path p1) + throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); + } + + @Override + public software.amazon.awssdk.services.s3.model.WriteGetObjectResponseResponse writeGetObjectResponse( + software.amazon.awssdk.services.s3.model.WriteGetObjectResponseRequest p0, + software.amazon.awssdk.core.sync.RequestBody p1) throws AwsServiceException, SdkClientException { + return executeInDefaultRegion(s3Client -> s3Client.writeGetObjectResponse(p0, p1)); + } } - From 9712fd0e2ba9d92dcaa22861c7248ce1e69f0b81 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 20:14:03 -0300 Subject: [PATCH 03/11] Fix style differences --- .../cloud/sqs/annotation/SqsListener.java | 4 +- .../SqsListenerAcknowledgmentMode.java | 5 +- .../sqs/integration/SqsIntegrationTests.java | 84 ++++++++++++------- 3 files changed, 59 insertions(+), 34 deletions(-) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index e2ea1c5fc..127adf1f5 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -138,8 +138,8 @@ String messageVisibilitySeconds() default ""; /** - * The acknowledgement mode to be used for the provided queues. If not specified, the acknowledgement mode defined - * for the container factory will be used. + * The acknowledgement mode to be used for the provided queues. If not specified, the + * acknowledgement mode defined for the container factory will be used. */ SqsListenerAcknowledgmentMode acknowledgmentMode() default SqsListenerAcknowledgmentMode.INHERIT; diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java index 0370e03f5..1b60b8ef3 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java @@ -31,6 +31,7 @@ * @see SqsListener */ public enum SqsListenerAcknowledgmentMode { + /** * Use acknowledge mode defined by the container. */ @@ -42,7 +43,8 @@ public enum SqsListenerAcknowledgmentMode { ON_SUCCESS, /** - * Messages will be acknowledged whether processing was completed successfully or with an error. + * Messages will be acknowledged whether processing was completed successfully or with + * an error. */ ALWAYS, @@ -51,4 +53,5 @@ public enum SqsListenerAcknowledgmentMode { * @see io.awspring.cloud.sqs.listener.acknowledgement.Acknowledgement */ MANUAL, + } diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java index 698c2eb99..b43bcc049 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java @@ -15,11 +15,6 @@ */ package io.awspring.cloud.sqs.integration; -import static java.util.Collections.singletonMap; -import static java.util.Map.entry; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - import com.fasterxml.jackson.databind.ObjectMapper; import io.awspring.cloud.sqs.CompletableFutures; import io.awspring.cloud.sqs.MessageHeaderUtils; @@ -49,17 +44,6 @@ import io.awspring.cloud.sqs.listener.source.AbstractSqsMessageSource; import io.awspring.cloud.sqs.listener.source.MessageSource; import io.awspring.cloud.sqs.operations.SqsTemplate; -import java.lang.reflect.Method; -import java.time.Duration; -import java.util.*; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; -import java.util.stream.IntStream; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -82,6 +66,28 @@ import software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequestEntry; import software.amazon.awssdk.services.sqs.model.QueueAttributeName; +import java.lang.reflect.Method; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.IntStream; + +import static java.util.Collections.singletonMap; +import static java.util.Map.entry; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + /** * Integration tests for SQS integration. * @@ -512,60 +518,76 @@ void listen(String message) throws BrokenBarrierException, InterruptedException } static class AnnotationAlwaysAcknowledgeOnSuccessMessagesListener { + @Autowired LatchContainer latchContainer; - @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", + acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationAlwaysAckSuccessLatch.countDown(); } + } static class AnnotationAlwaysAcknowledgeOnErrorMessagesListener { + @Autowired LatchContainer latchContainer; - @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", + acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationAlwaysAckErrorLatch.countDown(); throw new RuntimeException("Expected exception from annotation-ack-always-error"); } + } static class AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener { + @Autowired LatchContainer latchContainer; - @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, + factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", + acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationOnSuccessAckSuccessLatch.countDown(); } + } static class AnnotationOnSuccessAcknowledgeOnErrorMessagesListener { + @Autowired LatchContainer latchContainer; - @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, + id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationOnSuccessAckErrorLatch.countDown(); throw new RuntimeException("Expected exception from annotation-onsuccess-ack-error"); } + } static class AnnotationManualAcknowledgeMessagesListener { + @Autowired LatchContainer latchContainer; - @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", acknowledgmentMode = SqsListenerAcknowledgmentMode.MANUAL) + @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", + acknowledgmentMode = SqsListenerAcknowledgmentMode.MANUAL) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationManualAckLatch.countDown(); } + } // add message listners for manual ack modes @@ -930,18 +952,18 @@ public void onSuccess(Collection> messages) { SqsHeaders.SQS_QUEUE_NAME_HEADER); final Map latches = Map.ofEntries( - entry(RECEIVES_MESSAGE_QUEUE_NAME, latchContainer.acknowledgementCallbackSuccessLatch), - entry(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, latchContainer.annotationAlwaysAckSuccessLatch), - entry(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationAlwaysAckErrorLatch), - entry(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, latchContainer.annotationOnSuccessAckSuccessLatch), - entry(ANNOTATION_MANUAL_ACK_QUEUE_NAME, latchContainer.annotationManualAckLatchCallback) - ); + entry(RECEIVES_MESSAGE_QUEUE_NAME, latchContainer.acknowledgementCallbackSuccessLatch), + entry(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, + latchContainer.annotationAlwaysAckSuccessLatch), + entry(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationAlwaysAckErrorLatch), + entry(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, + latchContainer.annotationOnSuccessAckSuccessLatch), + entry(ANNOTATION_MANUAL_ACK_QUEUE_NAME, latchContainer.annotationManualAckLatchCallback)); if (latches.containsKey(queueName)) { latches.get(queueName).countDown(); } - } @Override @@ -952,9 +974,9 @@ public void onFailure(Collection> messages, Throwable t) { SqsHeaders.SQS_QUEUE_NAME_HEADER); final Map latches = Map.ofEntries( - entry(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME, latchContainer.acknowledgementCallbackErrorLatch), - entry(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationOnSuccessAckErrorCallbackLatch) - ); + entry(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME, latchContainer.acknowledgementCallbackErrorLatch), + entry(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + latchContainer.annotationOnSuccessAckErrorCallbackLatch)); if (latches.containsKey(queueName)) { latches.get(queueName).countDown(); From b94c432051917ddae0eeac85dc3a4cc30db70ecc Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 23:01:41 -0300 Subject: [PATCH 04/11] Rename acknowledgement enum to be consistent with other nomenclatures --- .../AbstractListenerAnnotationBeanPostProcessor.java | 4 ++-- .../awspring/cloud/sqs/annotation/SqsListener.java | 2 +- ...Mode.java => SqsListenerAcknowledgementMode.java} | 2 +- .../cloud/sqs/integration/SqsIntegrationTests.java | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) rename spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/{SqsListenerAcknowledgmentMode.java => SqsListenerAcknowledgementMode.java} (97%) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index 5a530420a..7014a610d 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -221,9 +221,9 @@ protected Integer resolveAsInteger(String value, String propertyName) { } @Nullable - protected AcknowledgementMode resolve(SqsListenerAcknowledgmentMode value) { + protected AcknowledgementMode resolve(SqsListenerAcknowledgementMode value) { try { - return value == SqsListenerAcknowledgmentMode.INHERIT ? null : AcknowledgementMode.valueOf(value.name()); + return value == SqsListenerAcknowledgementMode.INHERIT ? null : AcknowledgementMode.valueOf(value.name()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Cannot resolve " + value + " as AcknowledgementMode", e); diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index 127adf1f5..564b4184b 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -141,6 +141,6 @@ * The acknowledgement mode to be used for the provided queues. If not specified, the * acknowledgement mode defined for the container factory will be used. */ - SqsListenerAcknowledgmentMode acknowledgmentMode() default SqsListenerAcknowledgmentMode.INHERIT; + SqsListenerAcknowledgementMode acknowledgmentMode() default SqsListenerAcknowledgementMode.INHERIT; } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java similarity index 97% rename from spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java rename to spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java index 1b60b8ef3..4ec456fea 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgmentMode.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java @@ -30,7 +30,7 @@ * @see io.awspring.cloud.sqs.listener.ContainerOptions * @see SqsListener */ -public enum SqsListenerAcknowledgmentMode { +public enum SqsListenerAcknowledgementMode { /** * Use acknowledge mode defined by the container. diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java index b43bcc049..45442967e 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java @@ -19,7 +19,7 @@ import io.awspring.cloud.sqs.CompletableFutures; import io.awspring.cloud.sqs.MessageHeaderUtils; import io.awspring.cloud.sqs.annotation.SqsListener; -import io.awspring.cloud.sqs.annotation.SqsListenerAcknowledgmentMode; +import io.awspring.cloud.sqs.annotation.SqsListenerAcknowledgementMode; import io.awspring.cloud.sqs.config.SqsBootstrapConfiguration; import io.awspring.cloud.sqs.config.SqsListenerConfigurer; import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; @@ -523,7 +523,7 @@ static class AnnotationAlwaysAcknowledgeOnSuccessMessagesListener { LatchContainer latchContainer; @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", - acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + acknowledgmentMode = SqsListenerAcknowledgementMode.ALWAYS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationAlwaysAckSuccessLatch.countDown(); @@ -537,7 +537,7 @@ static class AnnotationAlwaysAcknowledgeOnErrorMessagesListener { LatchContainer latchContainer; @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", - acknowledgmentMode = SqsListenerAcknowledgmentMode.ALWAYS) + acknowledgmentMode = SqsListenerAcknowledgementMode.ALWAYS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationAlwaysAckErrorLatch.countDown(); @@ -553,7 +553,7 @@ static class AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener { @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", - acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + acknowledgmentMode = SqsListenerAcknowledgementMode.ON_SUCCESS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationOnSuccessAckSuccessLatch.countDown(); @@ -567,7 +567,7 @@ static class AnnotationOnSuccessAcknowledgeOnErrorMessagesListener { LatchContainer latchContainer; @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, - id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgmentMode.ON_SUCCESS) + id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgementMode.ON_SUCCESS) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationOnSuccessAckErrorLatch.countDown(); @@ -582,7 +582,7 @@ static class AnnotationManualAcknowledgeMessagesListener { LatchContainer latchContainer; @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", - acknowledgmentMode = SqsListenerAcknowledgmentMode.MANUAL) + acknowledgmentMode = SqsListenerAcknowledgementMode.MANUAL) void listen(String message) { logger.debug("Received message in Listener Method: " + message); latchContainer.annotationManualAckLatch.countDown(); From a11d16c2f67c4c048d52957009524dda8ec585f0 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 23:02:44 -0300 Subject: [PATCH 05/11] Update docs with @SqsListener acknowledgement mode param --- docs/src/main/asciidoc/sqs.adoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/src/main/asciidoc/sqs.adoc b/docs/src/main/asciidoc/sqs.adoc index 755996929..7a409485c 100644 --- a/docs/src/main/asciidoc/sqs.adoc +++ b/docs/src/main/asciidoc/sqs.adoc @@ -636,6 +636,8 @@ Note that if there are messages available the call may return earlier than this - `messageVisibilitySeconds` - Set the minimum visibility for the messages retrieved in a poll. Note that for `FIFO` single message listener methods, this visibility is applied to the whole batch before each message is sent to the listener. See <> for more information. +- `acknowledgementMode` - Set the acknowledgement mode for the container. Default value is `SqsListenerAcknowledgementMode.INHERIT`, +meaning that it will inherit the acknowledgement mode of the container factory. See <> for more information. ===== Listener Method Arguments @@ -1326,6 +1328,8 @@ NOTE: All options are available for both `single message` and `batch` message li - `ALWAYS` - Acknowledges a message or batch of messages after processing returns success or error. - `MANUAL` - The framework won't acknowledge messages automatically and `Acknowledgement` objects can be received in the listener method. +The `Acknowledgement` strategy can be configured in the `SqsContainerOptions` or in the `@SqsListener` annotation. + ==== Acknowledgement Batching The `acknowledgementInterval` and `acknowledgementThreshold` options enable acknowledgement batching. From 895aca15805aa3990772e750f54072471e58faa7 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Mon, 21 Aug 2023 23:18:14 -0300 Subject: [PATCH 06/11] Add JavaDoc for method and test enum value - Added missing JavaDoc for getAcknowledgementMode public method - Added test to ensure that new SqsListenerAcknowledgementMode enum will have the same values as the original AcknowledgementMode enum --- .../cloud/sqs/config/SqsEndpoint.java | 4 ++ .../SqsListenerAcknowledgementModeTests.java | 41 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java index eb3ba7306..deda9ab8d 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java @@ -96,6 +96,10 @@ public Duration getMessageVisibility() { return this.messageVisibility != null ? Duration.ofSeconds(this.messageVisibility) : null; } + /** + * Returns the acknowledgement mode configured for this endpoint. + * @return the acknowledgement mode. + */ @Nullable public AcknowledgementMode getAcknowledgementMode() { return this.acknowledgementMode; diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java new file mode 100644 index 000000000..50f5a4800 --- /dev/null +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java @@ -0,0 +1,41 @@ +/* + * Copyright 2013-2023 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.awspring.cloud.sqs.annotation; + +import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.EnumSource; + +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; +import static org.junit.jupiter.api.Assertions.assertEquals; + +/** + * Tests for {@link SqsListenerAcknowledgementMode} enum values + * + * @author Joao Calassio + */ +class SqsListenerAcknowledgementModeTests { + + @ParameterizedTest + @EnumSource(AcknowledgementMode.class) + void shouldHaveAllValuesOfAcknowledgementModeEnum(final AcknowledgementMode acknowledgementMode) { + final SqsListenerAcknowledgementMode correspondingValue = assertDoesNotThrow(() -> + SqsListenerAcknowledgementMode.valueOf(acknowledgementMode.name())); + assertEquals(acknowledgementMode.name(), correspondingValue.name()); + } + +} From 5b5eac31b6fe2c6e854370954c5ddb25578cb6aa Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Thu, 7 Sep 2023 19:14:57 -0300 Subject: [PATCH 07/11] Change annotation ack from enum to string - Change SqsListenerAcknowledgementMode from enum to class with const strings - Change typo on "acknowledgement" annotation field - Remove unnecessary field on SqsContainerOptionsBuilder - Move integration tests to its own test suite --- ...ctListenerAnnotationBeanPostProcessor.java | 6 +- .../cloud/sqs/annotation/SqsListener.java | 6 +- .../SqsListenerAcknowledgementMode.java | 13 +- ...qsListenerAnnotationBeanPostProcessor.java | 2 +- .../listener/SqsContainerOptionsBuilder.java | 8 - .../SqsListenerAcknowledgementModeTests.java | 16 +- ...tationAcknowledgementIntegrationTests.java | 408 ++++++++++++++++++ .../sqs/integration/SqsIntegrationTests.java | 252 ++--------- 8 files changed, 460 insertions(+), 251 deletions(-) create mode 100644 spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index 7014a610d..998f39749 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -221,9 +221,11 @@ protected Integer resolveAsInteger(String value, String propertyName) { } @Nullable - protected AcknowledgementMode resolve(SqsListenerAcknowledgementMode value) { + protected AcknowledgementMode resolveAcknowledgement(String value) { try { - return value == SqsListenerAcknowledgementMode.INHERIT ? null : AcknowledgementMode.valueOf(value.name()); + final String resolvedValue = resolveAsString(value, "acknowledgmentMode"); + return resolvedValue.equals(SqsListenerAcknowledgementMode.DEFAULT) ? null + : AcknowledgementMode.valueOf(resolvedValue); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Cannot resolve " + value + " as AcknowledgementMode", e); diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index 564b4184b..670bb4b8a 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -138,9 +138,9 @@ String messageVisibilitySeconds() default ""; /** - * The acknowledgement mode to be used for the provided queues. If not specified, the - * acknowledgement mode defined for the container factory will be used. + * The acknowledgement mode to be used for the provided queues. If not specified, the acknowledgement mode defined + * for the container factory will be used. */ - SqsListenerAcknowledgementMode acknowledgmentMode() default SqsListenerAcknowledgementMode.INHERIT; + String acknowledgementMode() default SqsListenerAcknowledgementMode.DEFAULT; } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java index 4ec456fea..e86f50266 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java @@ -30,28 +30,27 @@ * @see io.awspring.cloud.sqs.listener.ContainerOptions * @see SqsListener */ -public enum SqsListenerAcknowledgementMode { +public class SqsListenerAcknowledgementMode { /** * Use acknowledge mode defined by the container. */ - INHERIT, + public static final String DEFAULT = "DEFAULT"; /** * Messages will be acknowledged when message processing is successful. */ - ON_SUCCESS, + public static final String ON_SUCCESS = "ON_SUCCESS"; /** - * Messages will be acknowledged whether processing was completed successfully or with - * an error. + * Messages will be acknowledged whether processing was completed successfully or with an error. */ - ALWAYS, + public static final String ALWAYS = "ALWAYS"; /** * Messages will not be acknowledged automatically by the container. * @see io.awspring.cloud.sqs.listener.acknowledgement.Acknowledgement */ - MANUAL, + public static final String MANUAL = "MANUAL"; } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java index 48fe1231f..f8e2347b8 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java @@ -51,7 +51,7 @@ protected Endpoint createEndpoint(SqsListener sqsListenerAnnotation) { resolveAsInteger(sqsListenerAnnotation.maxConcurrentMessages(), "maxConcurrentMessages")) .messageVisibility( resolveAsInteger(sqsListenerAnnotation.messageVisibilitySeconds(), "messageVisibility")) - .acknowledgementMode(resolve(sqsListenerAnnotation.acknowledgmentMode())).build(); + .acknowledgementMode(resolveAcknowledgement(sqsListenerAnnotation.acknowledgementMode())).build(); } @Override diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java index 7b1388564..f52f562e3 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/listener/SqsContainerOptionsBuilder.java @@ -15,7 +15,6 @@ */ package io.awspring.cloud.sqs.listener; -import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; import java.time.Duration; import java.util.Collection; import software.amazon.awssdk.services.sqs.model.MessageSystemAttributeName; @@ -66,11 +65,4 @@ SqsContainerOptionsBuilder messageSystemAttributeNames( */ SqsContainerOptionsBuilder queueNotFoundStrategy(QueueNotFoundStrategy queueNotFoundStrategy); - /** - * Set the {@link AcknowledgementMode} for the container. - * @param acknowledgementMode the acknowledgement mode. - * @return this instance. - */ - SqsContainerOptionsBuilder acknowledgementMode(AcknowledgementMode acknowledgementMode); - } diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java index 50f5a4800..a58815a8b 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementModeTests.java @@ -15,14 +15,13 @@ */ package io.awspring.cloud.sqs.annotation; +import static org.junit.jupiter.api.Assertions.assertEquals; + import io.awspring.cloud.sqs.listener.acknowledgement.handler.AcknowledgementMode; -import org.junit.jupiter.api.Test; +import java.lang.reflect.Field; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.EnumSource; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; -import static org.junit.jupiter.api.Assertions.assertEquals; - /** * Tests for {@link SqsListenerAcknowledgementMode} enum values * @@ -32,10 +31,11 @@ class SqsListenerAcknowledgementModeTests { @ParameterizedTest @EnumSource(AcknowledgementMode.class) - void shouldHaveAllValuesOfAcknowledgementModeEnum(final AcknowledgementMode acknowledgementMode) { - final SqsListenerAcknowledgementMode correspondingValue = assertDoesNotThrow(() -> - SqsListenerAcknowledgementMode.valueOf(acknowledgementMode.name())); - assertEquals(acknowledgementMode.name(), correspondingValue.name()); + void shouldHaveAllValuesOfAcknowledgementModeEnum(final AcknowledgementMode acknowledgementMode) + throws NoSuchFieldException, IllegalAccessException { + Class clz = SqsListenerAcknowledgementMode.class; + Field correspondingValue = clz.getDeclaredField(acknowledgementMode.name()); + assertEquals(acknowledgementMode.name(), correspondingValue.get(clz)); } } diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java new file mode 100644 index 000000000..0238d2c7c --- /dev/null +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java @@ -0,0 +1,408 @@ +/* + * Copyright 2013-2023 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package io.awspring.cloud.sqs.integration; + +import static java.util.Collections.singletonMap; +import static java.util.Map.entry; +import static org.assertj.core.api.Assertions.assertThat; + +import io.awspring.cloud.sqs.CompletableFutures; +import io.awspring.cloud.sqs.MessageHeaderUtils; +import io.awspring.cloud.sqs.annotation.SqsListener; +import io.awspring.cloud.sqs.annotation.SqsListenerAcknowledgementMode; +import io.awspring.cloud.sqs.config.SqsBootstrapConfiguration; +import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; +import io.awspring.cloud.sqs.listener.ContainerComponentFactory; +import io.awspring.cloud.sqs.listener.SqsContainerOptions; +import io.awspring.cloud.sqs.listener.SqsHeaders; +import io.awspring.cloud.sqs.listener.StandardSqsComponentFactory; +import io.awspring.cloud.sqs.listener.acknowledgement.AcknowledgementExecutor; +import io.awspring.cloud.sqs.listener.acknowledgement.AcknowledgementResultCallback; +import io.awspring.cloud.sqs.listener.acknowledgement.SqsAcknowledgementExecutor; +import io.awspring.cloud.sqs.listener.errorhandler.AsyncErrorHandler; +import io.awspring.cloud.sqs.listener.source.AbstractSqsMessageSource; +import io.awspring.cloud.sqs.listener.source.MessageSource; +import io.awspring.cloud.sqs.operations.SqsTemplate; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.messaging.Message; +import org.springframework.test.context.TestPropertySource; +import software.amazon.awssdk.services.sqs.SqsAsyncClient; +import software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequestEntry; +import software.amazon.awssdk.services.sqs.model.QueueAttributeName; + +@SpringBootTest +@TestPropertySource(properties = { "test.property.acknowledgement=ALWAYS" }) +public class SqsAnnotationAcknowledgementIntegrationTests extends BaseSqsIntegrationTest { + + private static final Logger logger = LoggerFactory.getLogger(SqsAnnotationAcknowledgementIntegrationTests.class); + + static final String ACK_AFTER_SECOND_ERROR_FACTORY = "ackAfterSecondErrorFactory"; + + static final String ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME = "annotation_always_ack_success_test_queue"; + + static final String ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME = "annotation_always_ack_error_test_queue"; + + static final String ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME = "annotation_on_success_ack_success_test_queue"; + + static final String ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME = "annotation_on_success_ack_error_test_queue"; + + static final String ANNOTATION_MANUAL_ACK_QUEUE_NAME = "annotation_ack_manual_test_queue"; + + @Autowired + LatchContainer latchContainer; + + @Autowired + SqsTemplate sqsTemplate; + + @BeforeAll + static void beforeTests() { + SqsAsyncClient client = createAsyncClient(); + CompletableFuture.allOf(createQueue(client, ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME), + createQueue(client, ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME), + createQueue(client, ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME), + createQueue(client, ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + singletonMap(QueueAttributeName.VISIBILITY_TIMEOUT, "1")), + createQueue(client, ANNOTATION_MANUAL_ACK_QUEUE_NAME)).join(); + } + + @Test + void annotationAlwaysAckOnSuccess() throws Exception { + String messageBody = "annotationAlwaysAckOnSuccess-payload"; + sqsTemplate.send(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationAlwaysAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationAlwaysAckOnError() throws Exception { + String messageBody = "annotationAlwaysAckOnError-payload"; + sqsTemplate.send(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationAlwaysAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationOnSuccessAckOnSuccess() throws Exception { + String messageBody = "annotationOnSuccessAckOnSuccess-payload"; + sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationOnSuccessAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationOnSuccessAckOnError() throws Exception { + String messageBody = "annotationOnSuccessAckOnError-payload"; + sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + messageBody); + assertThat(latchContainer.annotationOnSuccessAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(latchContainer.annotationOnSuccessAckErrorCallbackLatch.await(10, TimeUnit.SECONDS)).isTrue(); + } + + @Test + void annotationManualAck() throws Exception { + String messageBody = "annotationManualAck-payload"; + sqsTemplate.send(ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); + logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); + assertThat(latchContainer.annotationManualAckLatch.await(10, TimeUnit.SECONDS)).isTrue(); + assertThat(latchContainer.annotationManualAckLatchCallback.await(10, TimeUnit.SECONDS)).isFalse(); + } + + static class AnnotationAlwaysAcknowledgeOnSuccessMessagesListener { + + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", acknowledgementMode = SqsListenerAcknowledgementMode.ALWAYS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationAlwaysAckSuccessLatch.countDown(); + } + + } + + static class AnnotationAlwaysAcknowledgeOnErrorMessagesListener { + + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", acknowledgementMode = "${test.property.acknowledgement}") + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationAlwaysAckErrorLatch.countDown(); + throw new RuntimeException("Expected exception from annotation-ack-always-error"); + } + + } + + static class AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener { + + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", acknowledgementMode = SqsListenerAcknowledgementMode.ON_SUCCESS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationOnSuccessAckSuccessLatch.countDown(); + } + + } + + static class AnnotationOnSuccessAcknowledgeOnErrorMessagesListener { + + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-error", acknowledgementMode = SqsListenerAcknowledgementMode.ON_SUCCESS) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationOnSuccessAckErrorLatch.countDown(); + throw new RuntimeException("Expected exception from annotation-onsuccess-ack-error"); + } + + } + + static class AnnotationManualAcknowledgeMessagesListener { + + @Autowired + LatchContainer latchContainer; + + @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", acknowledgementMode = SqsListenerAcknowledgementMode.MANUAL) + void listen(String message) { + logger.debug("Received message in Listener Method: " + message); + latchContainer.annotationManualAckLatch.countDown(); + } + + } + + static class LatchContainer { + + final CountDownLatch annotationAlwaysAckSuccessLatch = new CountDownLatch(2); + + final CountDownLatch annotationAlwaysAckErrorLatch = new CountDownLatch(2); + + final CountDownLatch annotationOnSuccessAckSuccessLatch = new CountDownLatch(2); + + final CountDownLatch annotationOnSuccessAckErrorLatch = new CountDownLatch(1); + + final CountDownLatch annotationOnSuccessAckErrorCallbackLatch = new CountDownLatch(1); + + final CountDownLatch annotationManualAckLatch = new CountDownLatch(1); + + final CountDownLatch annotationManualAckLatchCallback = new CountDownLatch(1); + + } + + @Import(SqsBootstrapConfiguration.class) + @Configuration + static class SQSConfiguration { + + LatchContainer latchContainer = new LatchContainer(); + + @Bean + LatchContainer latchContainer() { + return this.latchContainer; + } + + @Bean + SqsTemplate sqsTemplate() { + return SqsTemplate.builder().sqsAsyncClient(BaseSqsIntegrationTest.createAsyncClient()).build(); + } + + @Bean + AnnotationAlwaysAcknowledgeOnSuccessMessagesListener annotationAlwaysAcknowledgeOnSuccessMessagesListener() { + return new AnnotationAlwaysAcknowledgeOnSuccessMessagesListener(); + } + + @Bean + AnnotationAlwaysAcknowledgeOnErrorMessagesListener annotationAlwaysAcknowledgeOnErrorMessagesListener() { + return new AnnotationAlwaysAcknowledgeOnErrorMessagesListener(); + } + + @Bean + AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener annotationOnSuccessAcknowledgeOnSuccessMessagesListener() { + return new AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener(); + } + + @Bean + AnnotationOnSuccessAcknowledgeOnErrorMessagesListener annotationOnSuccessAcknowledgeOnErrorMessagesListener() { + return new AnnotationOnSuccessAcknowledgeOnErrorMessagesListener(); + } + + @Bean + AnnotationManualAcknowledgeMessagesListener annotationManualAcknowledgeMessagesListener() { + return new AnnotationManualAcknowledgeMessagesListener(); + } + + @Bean + public SqsMessageListenerContainerFactory defaultSqsListenerContainerFactory() { + return SqsMessageListenerContainerFactory.builder() + .sqsAsyncClientSupplier(BaseSqsIntegrationTest::createAsyncClient) + .acknowledgementResultCallback(getAcknowledgementResultCallback()) + .configure(options -> options.maxDelayBetweenPolls(Duration.ofSeconds(5)) + .queueAttributeNames(Collections.singletonList(QueueAttributeName.QUEUE_ARN)) + .pollTimeout(Duration.ofSeconds(5))) + .build(); + } + + @Bean(name = ACK_AFTER_SECOND_ERROR_FACTORY) + public SqsMessageListenerContainerFactory ackAfterSecondErrorFactory() { + return SqsMessageListenerContainerFactory.builder() + .configure(options -> options.maxConcurrentMessages(10).pollTimeout(Duration.ofSeconds(10)) + .maxMessagesPerPoll(10).maxDelayBetweenPolls(Duration.ofSeconds(1))) + .containerComponentFactories(getExceptionThrowingAckExecutor()) + .acknowledgementResultCallback(getAcknowledgementResultCallback()).errorHandler(testErrorHandler()) + .sqsAsyncClientSupplier(BaseSqsIntegrationTest::createAsyncClient).build(); + } + + private List> getExceptionThrowingAckExecutor() { + return Collections.singletonList(new StandardSqsComponentFactory() { + @Override + public MessageSource createMessageSource(SqsContainerOptions options) { + return new AbstractSqsMessageSource() { + @Override + protected AcknowledgementExecutor createAcknowledgementExecutorInstance() { + return new SqsAcknowledgementExecutor() { + + final AtomicBoolean hasThrown = new AtomicBoolean(); + + @Override + public CompletableFuture execute(Collection> messagesToAck) { + final String queueName = MessageHeaderUtils.getHeaderAsString( + messagesToAck.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER); + if (queueName.equals(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME) + && hasThrown.compareAndSet(false, true)) { + return CompletableFutures.failedFuture(new RuntimeException( + "Expected acknowledgement exception for " + queueName)); + } + return super.execute(messagesToAck); + } + }; + } + }; + } + }); + } + + private AcknowledgementResultCallback getAcknowledgementResultCallback() { + return new AcknowledgementResultCallback<>() { + @Override + public void onSuccess(Collection> messages) { + logger.debug("Invoking on success acknowledgement result callback for {}", + MessageHeaderUtils.getId(messages)); + final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), + SqsHeaders.SQS_QUEUE_NAME_HEADER); + + final Map latches = Map.ofEntries( + entry(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, + latchContainer.annotationAlwaysAckSuccessLatch), + entry(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationAlwaysAckErrorLatch), + entry(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, + latchContainer.annotationOnSuccessAckSuccessLatch), + entry(ANNOTATION_MANUAL_ACK_QUEUE_NAME, latchContainer.annotationManualAckLatchCallback)); + + if (latches.containsKey(queueName)) { + latches.get(queueName).countDown(); + } + } + + @Override + public void onFailure(Collection> messages, Throwable t) { + logger.debug("Invoking on failure acknowledgement result callback for {}", + MessageHeaderUtils.getId(messages)); + final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), + SqsHeaders.SQS_QUEUE_NAME_HEADER); + + final Map latches = Map + .ofEntries(entry(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, + latchContainer.annotationOnSuccessAckErrorCallbackLatch)); + + if (latches.containsKey(queueName)) { + latches.get(queueName).countDown(); + } + } + }; + } + + private AsyncErrorHandler testErrorHandler() { + return new AsyncErrorHandler() { + + final List previousMessages = Collections.synchronizedList(new ArrayList<>()); + + @Override + public CompletableFuture handle(Message message, Throwable t) { + // Eventually ack to not interfere with other tests. + if (previousMessages.contains(message.getPayload())) { + return CompletableFuture.completedFuture(null); + } + previousMessages.add(message.getPayload()); + return CompletableFutures.failedFuture(t); + } + + @Override + public CompletableFuture handle(Collection> messages, Throwable t) { + // Eventually ack to not interfere with other tests. + if (previousMessages.containsAll(toPayloadList(messages))) { + return CompletableFuture.completedFuture(null); + } + previousMessages.addAll(toPayloadList(messages)); + return CompletableFutures.failedFuture(t); + } + + private List toPayloadList(Collection> messages) { + return messages.stream().map(Message::getPayload).collect(Collectors.toList()); + } + + private Collection getBatchEntries( + Collection> messages) { + return messages.stream().map(this::getBatchEntry).collect(Collectors.toList()); + } + + private DeleteMessageBatchRequestEntry getBatchEntry(Message message) { + return DeleteMessageBatchRequestEntry.builder().id(UUID.randomUUID().toString()) + .receiptHandle( + MessageHeaderUtils.getHeaderAsString(message, SqsHeaders.SQS_RECEIPT_HANDLE_HEADER)) + .build(); + } + }; + } + + } + +} diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java index 45442967e..6141dae0b 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsIntegrationTests.java @@ -15,11 +15,14 @@ */ package io.awspring.cloud.sqs.integration; +import static java.util.Collections.singletonMap; +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; + import com.fasterxml.jackson.databind.ObjectMapper; import io.awspring.cloud.sqs.CompletableFutures; import io.awspring.cloud.sqs.MessageHeaderUtils; import io.awspring.cloud.sqs.annotation.SqsListener; -import io.awspring.cloud.sqs.annotation.SqsListenerAcknowledgementMode; import io.awspring.cloud.sqs.config.SqsBootstrapConfiguration; import io.awspring.cloud.sqs.config.SqsListenerConfigurer; import io.awspring.cloud.sqs.config.SqsMessageListenerContainerFactory; @@ -44,6 +47,21 @@ import io.awspring.cloud.sqs.listener.source.AbstractSqsMessageSource; import io.awspring.cloud.sqs.listener.source.MessageSource; import io.awspring.cloud.sqs.operations.SqsTemplate; +import java.lang.reflect.Method; +import java.time.Duration; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.BrokenBarrierException; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; +import java.util.stream.IntStream; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.slf4j.Logger; @@ -66,28 +84,6 @@ import software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequestEntry; import software.amazon.awssdk.services.sqs.model.QueueAttributeName; -import java.lang.reflect.Method; -import java.time.Duration; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import java.util.concurrent.BrokenBarrierException; -import java.util.concurrent.CompletableFuture; -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.CyclicBarrier; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.stream.Collectors; -import java.util.stream.IntStream; - -import static java.util.Collections.singletonMap; -import static java.util.Map.entry; -import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; - /** * Integration tests for SQS integration. * @@ -134,16 +130,6 @@ class SqsIntegrationTests extends BaseSqsIntegrationTest { static final String ACK_AFTER_SECOND_ERROR_FACTORY = "ackAfterSecondErrorFactory"; - static final String ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME = "annotation_always_ack_success_test_queue"; - - static final String ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME = "annotation_always_ack_error_test_queue"; - - static final String ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME = "annotation_on_success_ack_success_test_queue"; - - static final String ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME = "annotation_on_success_ack_error_test_queue"; - - static final String ANNOTATION_MANUAL_ACK_QUEUE_NAME = "annotation_ack_manual_test_queue"; - @BeforeAll static void beforeTests() { SqsAsyncClient client = createAsyncClient(); @@ -163,13 +149,7 @@ static void beforeTests() { createQueue(client, MANUALLY_CREATE_CONTAINER_QUEUE_NAME), createQueue(client, MANUALLY_CREATE_INACTIVE_CONTAINER_QUEUE_NAME), createQueue(client, MANUALLY_CREATE_FACTORY_QUEUE_NAME), - createQueue(client, MAX_CONCURRENT_MESSAGES_QUEUE_NAME), - createQueue(client, ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME), - createQueue(client, ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME), - createQueue(client, ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME), - createQueue(client, ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, - singletonMap(QueueAttributeName.VISIBILITY_TIMEOUT, "1")), - createQueue(client, ANNOTATION_MANUAL_ACK_QUEUE_NAME)).join(); + createQueue(client, MAX_CONCURRENT_MESSAGES_QUEUE_NAME)).join(); } @Autowired @@ -251,52 +231,6 @@ void doesNotAckOnErrorBatchAsync() throws Exception { assertThat(latchContainer.doesNotAckBatchAsyncLatch.await(10, TimeUnit.SECONDS)).isTrue(); } - @Test - void annotationAlwaysAckOnSuccess() throws Exception { - String messageBody = "annotationAlwaysAckOnSuccess-payload"; - sqsTemplate.send(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, messageBody); - logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, - messageBody); - assertThat(latchContainer.annotationAlwaysAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); - } - - @Test - void annotationAlwaysAckOnError() throws Exception { - String messageBody = "annotationAlwaysAckOnError-payload"; - sqsTemplate.send(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, messageBody); - logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, - messageBody); - assertThat(latchContainer.annotationAlwaysAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); - } - - @Test - void annotationOnSuccessAckOnSuccess() throws Exception { - String messageBody = "annotationOnSuccessAckOnSuccess-payload"; - sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, messageBody); - logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, - messageBody); - assertThat(latchContainer.annotationOnSuccessAckSuccessLatch.await(10, TimeUnit.SECONDS)).isTrue(); - } - - @Test - void annotationOnSuccessAckOnError() throws Exception { - String messageBody = "annotationOnSuccessAckOnError-payload"; - sqsTemplate.send(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, messageBody); - logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, - messageBody); - assertThat(latchContainer.annotationOnSuccessAckErrorLatch.await(10, TimeUnit.SECONDS)).isTrue(); - assertThat(latchContainer.annotationOnSuccessAckErrorCallbackLatch.await(10, TimeUnit.SECONDS)).isTrue(); - } - - @Test - void annotationManualAck() throws Exception { - String messageBody = "annotationManualAck-payload"; - sqsTemplate.send(ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); - logger.debug("Sent message to queue {} with messageBody {}", ANNOTATION_MANUAL_ACK_QUEUE_NAME, messageBody); - assertThat(latchContainer.annotationManualAckLatch.await(10, TimeUnit.SECONDS)).isTrue(); - assertThat(latchContainer.annotationManualAckLatchCallback.await(10, TimeUnit.SECONDS)).isFalse(); - } - @Test void resolvesManyParameterTypes() throws Exception { String messageBody = "many-parameter-types-payload"; @@ -517,81 +451,6 @@ void listen(String message) throws BrokenBarrierException, InterruptedException } } - static class AnnotationAlwaysAcknowledgeOnSuccessMessagesListener { - - @Autowired - LatchContainer latchContainer; - - @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, id = "annotation-always-ack-success", - acknowledgmentMode = SqsListenerAcknowledgementMode.ALWAYS) - void listen(String message) { - logger.debug("Received message in Listener Method: " + message); - latchContainer.annotationAlwaysAckSuccessLatch.countDown(); - } - - } - - static class AnnotationAlwaysAcknowledgeOnErrorMessagesListener { - - @Autowired - LatchContainer latchContainer; - - @SqsListener(queueNames = ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, id = "annotation-always-ack-error", - acknowledgmentMode = SqsListenerAcknowledgementMode.ALWAYS) - void listen(String message) { - logger.debug("Received message in Listener Method: " + message); - latchContainer.annotationAlwaysAckErrorLatch.countDown(); - throw new RuntimeException("Expected exception from annotation-ack-always-error"); - } - - } - - static class AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener { - - @Autowired - LatchContainer latchContainer; - - @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, - factory = ACK_AFTER_SECOND_ERROR_FACTORY, id = "annotation-onsuccess-ack-success", - acknowledgmentMode = SqsListenerAcknowledgementMode.ON_SUCCESS) - void listen(String message) { - logger.debug("Received message in Listener Method: " + message); - latchContainer.annotationOnSuccessAckSuccessLatch.countDown(); - } - - } - - static class AnnotationOnSuccessAcknowledgeOnErrorMessagesListener { - - @Autowired - LatchContainer latchContainer; - - @SqsListener(queueNames = ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, factory = ACK_AFTER_SECOND_ERROR_FACTORY, - id = "annotation-onsuccess-ack-error", acknowledgmentMode = SqsListenerAcknowledgementMode.ON_SUCCESS) - void listen(String message) { - logger.debug("Received message in Listener Method: " + message); - latchContainer.annotationOnSuccessAckErrorLatch.countDown(); - throw new RuntimeException("Expected exception from annotation-onsuccess-ack-error"); - } - - } - - static class AnnotationManualAcknowledgeMessagesListener { - - @Autowired - LatchContainer latchContainer; - - @SqsListener(queueNames = ANNOTATION_MANUAL_ACK_QUEUE_NAME, id = "annotation-manual-ack", - acknowledgmentMode = SqsListenerAcknowledgementMode.MANUAL) - void listen(String message) { - logger.debug("Received message in Listener Method: " + message); - latchContainer.annotationManualAckLatch.countDown(); - } - - } - - // add message listners for manual ack modes - static class LatchContainer { final CountDownLatch receivesMessageLatch = new CountDownLatch(1); @@ -616,13 +475,7 @@ static class LatchContainer { final CountDownLatch acknowledgementCallbackErrorLatch = new CountDownLatch(1); final CountDownLatch manuallyInactiveCreatedContainerLatch = new CountDownLatch(1); final CyclicBarrier maxConcurrentMessagesBarrier = new CyclicBarrier(21); - final CountDownLatch annotationAlwaysAckSuccessLatch = new CountDownLatch(2); - final CountDownLatch annotationAlwaysAckErrorLatch = new CountDownLatch(2); - final CountDownLatch annotationOnSuccessAckSuccessLatch = new CountDownLatch(2); - final CountDownLatch annotationOnSuccessAckErrorLatch = new CountDownLatch(1); - final CountDownLatch annotationOnSuccessAckErrorCallbackLatch = new CountDownLatch(1); - final CountDownLatch annotationManualAckLatch = new CountDownLatch(1); - final CountDownLatch annotationManualAckLatchCallback = new CountDownLatch(1); + } @Import(SqsBootstrapConfiguration.class) @@ -690,11 +543,10 @@ protected AcknowledgementExecutor createAcknowledgementExecutorInstance( @Override public CompletableFuture execute(Collection> messagesToAck) { - final String queueName = MessageHeaderUtils - .getHeaderAsString(messagesToAck.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER); - if ((queueName.equals(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME) || queueName.equals(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME)) + if (MessageHeaderUtils + .getHeaderAsString(messagesToAck.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER).equals(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME) && hasThrown.compareAndSet(false, true)) { - return CompletableFutures.failedFuture(new RuntimeException("Expected acknowledgement exception for " + queueName)); + return CompletableFutures.failedFuture(new RuntimeException("Expected acknowledgement exception for " + DOES_NOT_ACK_ON_ERROR_QUEUE_NAME)); } return super.execute(messagesToAck); } @@ -826,31 +678,6 @@ DoesNotAckOnErrorAsyncBatchListener doesNotAckOnErrorAsyncBatchListener() { return new DoesNotAckOnErrorAsyncBatchListener(); } - @Bean - AnnotationAlwaysAcknowledgeOnSuccessMessagesListener annotationAlwaysAcknowledgeOnSuccessMessagesListener() { - return new AnnotationAlwaysAcknowledgeOnSuccessMessagesListener(); - } - - @Bean - AnnotationAlwaysAcknowledgeOnErrorMessagesListener annotationAlwaysAcknowledgeOnErrorMessagesListener() { - return new AnnotationAlwaysAcknowledgeOnErrorMessagesListener(); - } - - @Bean - AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener annotationOnSuccessAcknowledgeOnSuccessMessagesListener() { - return new AnnotationOnSuccessAcknowledgeOnSuccessMessagesListener(); - } - - @Bean - AnnotationOnSuccessAcknowledgeOnErrorMessagesListener annotationOnSuccessAcknowledgeOnErrorMessagesListener() { - return new AnnotationOnSuccessAcknowledgeOnErrorMessagesListener(); - } - - @Bean - AnnotationManualAcknowledgeMessagesListener annotationManualAcknowledgeMessagesListener() { - return new AnnotationManualAcknowledgeMessagesListener(); - } - @Bean ResolvesParameterTypesListener resolvesParameterTypesListener() { return new ResolvesParameterTypesListener(); @@ -948,38 +775,19 @@ private AcknowledgementResultCallback getAcknowledgementResultCallback() public void onSuccess(Collection> messages) { logger.debug("Invoking on success acknowledgement result callback for {}", MessageHeaderUtils.getId(messages)); - final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), - SqsHeaders.SQS_QUEUE_NAME_HEADER); - - final Map latches = Map.ofEntries( - entry(RECEIVES_MESSAGE_QUEUE_NAME, latchContainer.acknowledgementCallbackSuccessLatch), - entry(ANNOTATION_ALWAYS_ACK_SUCCESS_QUEUE_NAME, - latchContainer.annotationAlwaysAckSuccessLatch), - entry(ANNOTATION_ALWAYS_ACK_ERROR_QUEUE_NAME, latchContainer.annotationAlwaysAckErrorLatch), - entry(ANNOTATION_ON_SUCCESS_ACK_SUCCESS_QUEUE_NAME, - latchContainer.annotationOnSuccessAckSuccessLatch), - entry(ANNOTATION_MANUAL_ACK_QUEUE_NAME, latchContainer.annotationManualAckLatchCallback)); - - if (latches.containsKey(queueName)) { - latches.get(queueName).countDown(); + if (RECEIVES_MESSAGE_QUEUE_NAME.equals(MessageHeaderUtils + .getHeaderAsString(messages.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER))) { + latchContainer.acknowledgementCallbackSuccessLatch.countDown(); } - } @Override public void onFailure(Collection> messages, Throwable t) { logger.debug("Invoking on failure acknowledgement result callback for {}", MessageHeaderUtils.getId(messages)); - final String queueName = MessageHeaderUtils.getHeaderAsString(messages.iterator().next(), - SqsHeaders.SQS_QUEUE_NAME_HEADER); - - final Map latches = Map.ofEntries( - entry(DOES_NOT_ACK_ON_ERROR_QUEUE_NAME, latchContainer.acknowledgementCallbackErrorLatch), - entry(ANNOTATION_ON_SUCCESS_ACK_ERROR_QUEUE_NAME, - latchContainer.annotationOnSuccessAckErrorCallbackLatch)); - - if (latches.containsKey(queueName)) { - latches.get(queueName).countDown(); + if (DOES_NOT_ACK_ON_ERROR_QUEUE_NAME.equals(MessageHeaderUtils + .getHeaderAsString(messages.iterator().next(), SqsHeaders.SQS_QUEUE_NAME_HEADER))) { + latchContainer.acknowledgementCallbackErrorLatch.countDown(); } } }; From 24e5a80968883b3445f1ea8f8c9db408922e9a13 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Thu, 7 Sep 2023 19:27:07 -0300 Subject: [PATCH 08/11] Update documentation and code comments - Update docs to reflect new "DEFAULT" annotation ack mode - Update comments with latest changes --- docs/src/main/asciidoc/sqs.adoc | 4 ++-- .../AbstractListenerAnnotationBeanPostProcessor.java | 2 +- .../cloud/sqs/annotation/SqsListenerAcknowledgementMode.java | 2 +- .../SqsAnnotationAcknowledgementIntegrationTests.java | 5 +++++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/docs/src/main/asciidoc/sqs.adoc b/docs/src/main/asciidoc/sqs.adoc index 7a409485c..2161ab07f 100644 --- a/docs/src/main/asciidoc/sqs.adoc +++ b/docs/src/main/asciidoc/sqs.adoc @@ -636,8 +636,8 @@ Note that if there are messages available the call may return earlier than this - `messageVisibilitySeconds` - Set the minimum visibility for the messages retrieved in a poll. Note that for `FIFO` single message listener methods, this visibility is applied to the whole batch before each message is sent to the listener. See <> for more information. -- `acknowledgementMode` - Set the acknowledgement mode for the container. Default value is `SqsListenerAcknowledgementMode.INHERIT`, -meaning that it will inherit the acknowledgement mode of the container factory. See <> for more information. +- `acknowledgementMode` - Set the acknowledgement mode for the container. Default value is `SqsListenerAcknowledgementMode.DEFAULT`, +meaning that it will use the acknowledgement mode defined for the container factory. See <> for more information. ===== Listener Method Arguments diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index 998f39749..42b9d69c0 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -223,7 +223,7 @@ protected Integer resolveAsInteger(String value, String propertyName) { @Nullable protected AcknowledgementMode resolveAcknowledgement(String value) { try { - final String resolvedValue = resolveAsString(value, "acknowledgmentMode"); + final String resolvedValue = resolveAsString(value, "acknowledgementMode"); return resolvedValue.equals(SqsListenerAcknowledgementMode.DEFAULT) ? null : AcknowledgementMode.valueOf(resolvedValue); } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java index e86f50266..11eefb9b3 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java @@ -20,7 +20,7 @@ import io.awspring.cloud.sqs.listener.acknowledgement.handler.OnSuccessAcknowledgementHandler; /** - * Configures the acknowledgement behavior for the container. + * Acknowledgement strategies supported by the {@link SqsListener} annotation. * * @author Joao Calassio * @since 3.1 diff --git a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java index 0238d2c7c..2784732b6 100644 --- a/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java +++ b/spring-cloud-aws-sqs/src/test/java/io/awspring/cloud/sqs/integration/SqsAnnotationAcknowledgementIntegrationTests.java @@ -63,6 +63,11 @@ import software.amazon.awssdk.services.sqs.model.DeleteMessageBatchRequestEntry; import software.amazon.awssdk.services.sqs.model.QueueAttributeName; +/** + * Integration tests for custom acknowledgement modes on SqsListener annotation + * + * @author Joao Calassio + */ @SpringBootTest @TestPropertySource(properties = { "test.property.acknowledgement=ALWAYS" }) public class SqsAnnotationAcknowledgementIntegrationTests extends BaseSqsIntegrationTest { From 69910c707de23d182414bcda28a542bc4611b880 Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Thu, 14 Sep 2023 23:15:44 -0300 Subject: [PATCH 09/11] Set empty string as default behavior - Remove "DEFAULT" annotation acknowledgement mode, use empty string as default - Update docs --- docs/src/main/asciidoc/sqs.adoc | 6 ++-- ...ctListenerAnnotationBeanPostProcessor.java | 30 +++++++++---------- .../cloud/sqs/annotation/SqsListener.java | 2 +- .../SqsListenerAcknowledgementMode.java | 5 ---- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/docs/src/main/asciidoc/sqs.adoc b/docs/src/main/asciidoc/sqs.adoc index 2161ab07f..d3969559a 100644 --- a/docs/src/main/asciidoc/sqs.adoc +++ b/docs/src/main/asciidoc/sqs.adoc @@ -636,9 +636,9 @@ Note that if there are messages available the call may return earlier than this - `messageVisibilitySeconds` - Set the minimum visibility for the messages retrieved in a poll. Note that for `FIFO` single message listener methods, this visibility is applied to the whole batch before each message is sent to the listener. See <> for more information. -- `acknowledgementMode` - Set the acknowledgement mode for the container. Default value is `SqsListenerAcknowledgementMode.DEFAULT`, -meaning that it will use the acknowledgement mode defined for the container factory. See <> for more information. - +- `acknowledgementMode` - Set the acknowledgement mode for the container. +If any value is set, it will take precedence over the acknowledgement mode defined for the container factory options. +See <> for more information. ===== Listener Method Arguments diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index 42b9d69c0..c9eba8186 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -26,19 +26,6 @@ import io.awspring.cloud.sqs.support.resolver.AcknowledgmentHandlerMethodArgumentResolver; import io.awspring.cloud.sqs.support.resolver.BatchAcknowledgmentArgumentResolver; import io.awspring.cloud.sqs.support.resolver.BatchPayloadMethodArgumentResolver; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.concurrent.atomic.AtomicInteger; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import java.util.stream.StreamSupport; import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -70,6 +57,20 @@ import org.springframework.util.Assert; import org.springframework.util.StringUtils; +import java.lang.annotation.Annotation; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; + /** * {@link BeanPostProcessor} implementation that scans beans for a {@link SqsListener @SqsListener} annotation, extracts * information to a {@link SqsEndpoint}, and registers it in the {@link EndpointRegistrar}. @@ -224,8 +225,7 @@ protected Integer resolveAsInteger(String value, String propertyName) { protected AcknowledgementMode resolveAcknowledgement(String value) { try { final String resolvedValue = resolveAsString(value, "acknowledgementMode"); - return resolvedValue.equals(SqsListenerAcknowledgementMode.DEFAULT) ? null - : AcknowledgementMode.valueOf(resolvedValue); + return StringUtils.hasText(resolvedValue) ? null : AcknowledgementMode.valueOf(resolvedValue); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Cannot resolve " + value + " as AcknowledgementMode", e); diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index 670bb4b8a..977c008a3 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -141,6 +141,6 @@ * The acknowledgement mode to be used for the provided queues. If not specified, the acknowledgement mode defined * for the container factory will be used. */ - String acknowledgementMode() default SqsListenerAcknowledgementMode.DEFAULT; + String acknowledgementMode() default ""; } diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java index 11eefb9b3..0044a10a8 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAcknowledgementMode.java @@ -32,11 +32,6 @@ */ public class SqsListenerAcknowledgementMode { - /** - * Use acknowledge mode defined by the container. - */ - public static final String DEFAULT = "DEFAULT"; - /** * Messages will be acknowledged when message processing is successful. */ From 7570c1602d9e524e69898d0748f3316cd63e620d Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Thu, 14 Sep 2023 23:16:50 -0300 Subject: [PATCH 10/11] Add author after latest changes - Add author on modified classes --- .../annotation/AbstractListenerAnnotationBeanPostProcessor.java | 1 + .../main/java/io/awspring/cloud/sqs/annotation/SqsListener.java | 1 + .../sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java | 1 + .../src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java | 1 + .../cloud/sqs/config/SqsMessageListenerContainerFactory.java | 1 + 5 files changed, 5 insertions(+) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index c9eba8186..9aeb98f40 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -76,6 +76,7 @@ * information to a {@link SqsEndpoint}, and registers it in the {@link EndpointRegistrar}. * * @author Tomaz Fernandes + * @author Joao Calassio * @since 3.0 */ public abstract class AbstractListenerAnnotationBeanPostProcessor diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java index 977c008a3..a110580c8 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListener.java @@ -74,6 +74,7 @@ * @author Alain Sahli * @author Matej Nedic * @author Tomaz Fernandes + * @author Joao Calassio * @since 1.1 */ @Target(ElementType.METHOD) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java index f8e2347b8..74b2fed89 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/SqsListenerAnnotationBeanPostProcessor.java @@ -30,6 +30,7 @@ * {@link AbstractListenerAnnotationBeanPostProcessor} implementation for {@link SqsListener @SqsListener}. * * @author Tomaz Fernandes + * @author Joao Calassio * @since 3.0 */ public class SqsListenerAnnotationBeanPostProcessor extends AbstractListenerAnnotationBeanPostProcessor { diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java index deda9ab8d..908ad608d 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsEndpoint.java @@ -27,6 +27,7 @@ * Contains properties that should be mapped from {@link SqsListener @SqsListener} annotations. * * @author Tomaz Fernandes + * @author Joao Calassio * @since 3.0 */ public class SqsEndpoint extends AbstractEndpoint { diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java index d001a25d7..1b335b3c4 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/config/SqsMessageListenerContainerFactory.java @@ -122,6 +122,7 @@ * used. * * @author Tomaz Fernandes + * @author Joao Calassio * @since 3.0 * @see SqsMessageListenerContainer * @see ContainerOptions From fab5d97101ea3cdee21a686cac26d201f28e1d0b Mon Sep 17 00:00:00 2001 From: jvcalassio Date: Wed, 4 Oct 2023 00:04:51 -0300 Subject: [PATCH 11/11] Fix inverted condition when resolving AcknowledgementMode value --- .../annotation/AbstractListenerAnnotationBeanPostProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java index 9aeb98f40..dc9f166c6 100644 --- a/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java +++ b/spring-cloud-aws-sqs/src/main/java/io/awspring/cloud/sqs/annotation/AbstractListenerAnnotationBeanPostProcessor.java @@ -226,7 +226,7 @@ protected Integer resolveAsInteger(String value, String propertyName) { protected AcknowledgementMode resolveAcknowledgement(String value) { try { final String resolvedValue = resolveAsString(value, "acknowledgementMode"); - return StringUtils.hasText(resolvedValue) ? null : AcknowledgementMode.valueOf(resolvedValue); + return StringUtils.hasText(resolvedValue) ? AcknowledgementMode.valueOf(resolvedValue) : null; } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Cannot resolve " + value + " as AcknowledgementMode", e);