Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add client customizer interface for each supported integration. #1229

Merged
merged 19 commits into from
Sep 29, 2024

Conversation

maciejwalkowiak
Copy link
Contributor

@maciejwalkowiak maciejwalkowiak commented Sep 22, 2024

Fixes #562

  • allows defining a customizer for each supported AWS client builder, for example, to configure DynamoDbClientBuilder user must define one or more DynamoDbClientCustomizer
  • there can be multiple customizers for each builder, @Order is taken into consideration when applying customization
  • to customize every SDK client (sync/async) - for example to configure a custom HTTP client applied to all SDK clients - users can define one or more CommonAwsSyncClientCustomizer (for sync) or CommonAwsAsyncClientCustomizer (for async) beans.

Example:

@Bean
@Order(1)
DynamoDbClientCustomizer dynamoDbClientCustomizer() {
	return builder -> {
		builder.overrideConfiguration(builder.overrideConfiguration().copy(c -> {
			c.apiCallTimeout(Duration.ofMillis(2001));
		}));
	};
}

@Bean
@Order(2)
DynamoDbClientCustomizer dynamoDbClientCustomizer2() {
	return builder -> {
		builder.overrideConfiguration(builder.overrideConfiguration().copy(c -> {
			c.apiCallAttemptTimeout(Duration.ofMillis(2002));
		}));
	};
}

@Bean
CommonAwsSyncClientCustomizer commonAwsSyncClientCustomizer() {
	return builder -> {
		builder.httpClient(ApacheHttpClient.builder().connectionTimeout(Duration.ofMillis(1542)).build());
	};
}

@github-actions github-actions bot added component: cloudwatch CloudWatch integration related issue component: core Core functionality related issue component: dynamodb DynamoDB integration related issue component: parameter-store Parameter Store integration related issue component: s3 S3 integration related issue component: secrets-manager Secrets Manager integration related issue component: ses SES integration related issue component: sns SNS integration related issue component: sqs SQS integration related issue labels Sep 22, 2024
@github-actions github-actions bot added the type: documentation Documentation or Samples related issue label Sep 23, 2024
@@ -254,6 +254,33 @@ The Spring Boot Starter for S3 provides the following configuration options:
| `spring.cloud.aws.s3.transfer-manager.follow-symbolic-links` | Specifies whether to follow symbolic links when traversing the file tree in `S3TransferManager#uploadDirectory` operation | No | `null` (falls back to SDK default)
|===

=== Client Customization
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this looks fine, similar docs will be added to each integration.

* {@link #configureSyncClient(AwsClientBuilder, AwsClientProperties, AwsConnectionDetails, Stream, Stream)}.
*/
@Deprecated
public <T extends AwsClientBuilder<T, ?>> T configureSyncClient(T builder,
Copy link
Contributor Author

@maciejwalkowiak maciejwalkowiak Sep 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for the backward compatibility these methods must be added, but they are marked as deprecated to prevent users from using them in the new code.

@MatejNedic
Copy link
Member

Really like the idea. Will follow up with detail Review but idea as it is I love it much better user experience

@MatejNedic
Copy link
Member

@maciejwalkowiak reviewed good to go!

@maciejwalkowiak maciejwalkowiak merged commit 8020ef1 into main Sep 29, 2024
4 checks passed
@maciejwalkowiak maciejwalkowiak deleted the gh-562 branch September 29, 2024 07:21
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@maciejwalkowiak maciejwalkowiak modified the milestones: 3.3.0, 3.3.0 M1 Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: cloudwatch CloudWatch integration related issue component: core Core functionality related issue component: dynamodb DynamoDB integration related issue component: parameter-store Parameter Store integration related issue component: s3 S3 integration related issue component: secrets-manager Secrets Manager integration related issue component: ses SES integration related issue component: sns SNS integration related issue component: sqs SQS integration related issue type: documentation Documentation or Samples related issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make AwsClientCustomizer Flexible
2 participants