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 support for AppConfigDataClient in AWS SDK #60

Merged
merged 1 commit into from
Jun 1, 2024
Merged

Conversation

lavenderses
Copy link
Owner

What

Add new support for AppConfigDataClient.

closes #51.

How

AppConfig access costs money. So, I choose the way keeps the feature flags in local cache, not to request to it every flag evaluation.

CachedFeatureFlagManager

The core of local caching is CachedFeatureFlagManager.

This manages following things.

  • local feature flags cache
  • session for AWS AppConfig
  • safe close of the resource (thread, connection to AWS AppConfig)

Also, an infastructure for executing infinite task is introduced.
This is ScheduledTaskExecutor.

Using this feature

Application Author who is using this provider implementatin can use this feature by configuring AwsAppConfigDataClientProxyConfig.
This proxy config is for using AwsAppConfigDataClientProxy, which proxys the feature flag request to AWS AppConfig through AppConfigDataClient.

e.g.

// provider configuration
AwsAppConfigClientOptions options = AwsAppConfigClientOptions.builder()
        .applicationName("AWS AppConfig application name")
        .environmentName("AWS AppConfig environment name")
        .profile("AWS AppConfig profile name")
        .awsAppConfigProxyConfig(
            // access AWS AppConfig via using `AppConfigDataClient`.
            AwsAppConfigDataClientProxyConfig.builder()
                // your aws region
                .region(Region.AP_NORTHEAST_1)
                // feature flags polling duration. this will affect AWS cost
                .pollingDelay(Duration.ZERO)
                .build()
        )
        .build();

// configure a provider
AwsAppConfigFeatureProvider provider = new AwsAppConfigFeatureProvider(options);

docs. https://sdk.amazonaws.com/java/api/2.25.45/software/amazon/awssdk/services/appconfigdata/AppConfigDataClient.html

Notes

Supporting use of AppConfigDataClient instance application author instantinated will be in the future.

@lavenderses lavenderses added the enhancement New feature or request label Jun 1, 2024
@lavenderses lavenderses self-assigned this Jun 1, 2024
Copy link
Owner Author

@lavenderses lavenderses left a comment

Choose a reason for hiding this comment

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

LGTM

@lavenderses lavenderses merged commit c708115 into main Jun 1, 2024
4 checks passed
@lavenderses lavenderses deleted the lavenderses/51 branch June 1, 2024 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support using AppConfigDataClient for retrieving feature flag
1 participant