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

Remove url-connector http lib dependency, require GlueClientBuilder input to AWSSchemaRegistryClient #263

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dbottini
Copy link

Issue: #120 (Primary)

Description:
AWSSchemaRegistryClient in the common module directly imports the UrlConnectionHttpClient, which can cause classpath friction with AWS SDK in other places where ApacheHttpClient is preferred, and the ServiceLoader can't figure out which client to use. An example of this is when using the Kinesis Client Library v2, their addition of this library pollutes the classpath, when it ideally should've waited for a user to deliberately configure in the UrlConnectionHttpClient through a GlueClient. This change prefers rely on the GlueClient defaults, or gives the user full access to the GlueClient builder. It still reserves the right to add some overrides around endpoint, region, etc.

This does break the bespoke integration with the UrlConnection Proxy Url, and now requires manually configuring the Glue Client. This may further impact scenarios where Proxy Url was specified using one of the higher-order libraries around common, where the user expects GlueSchemaRegistryConfiguration to set everything up. Now, to create an object like GlueSchemaRegistrySerializationFacade, the user has to also create SchemaByDefinitionFetcher which then wraps AWSSchemaRegistryClient which then wraps GlueClient which contains a manually configured UrlConnectionHttpClient with a proxy url.

The url-connection http lib was likely unintentionally added in https://github.com/awslabs/aws-glue-schema-registry/pull/49/files#diff-79d226ed87c480fcfac3a55dfae33d93c29b6b43f7eebbb1369a4557581431bd, and the proxy url functionality was cemented on in #246. It's worth noting that the initial issue, #245, was attempting to directly insert a GlueClient, so this is more cohesive with their initial approach.

Related reports of issue:
#127
https://stackoverflow.com/a/75323773

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@dbottini
Copy link
Author

It seems there's some old code from my initial attempt before a refactor. I also knocked out one of the constructors - I'll tidy those up.

@@ -65,8 +64,7 @@ public GlueSchemaRegistrySerializationFacade(@NonNull AwsCredentialsProvider cre

if (this.schemaByDefinitionFetcher == null) {
final AWSSchemaRegistryClient client =
new AWSSchemaRegistryClient(credentialProvider, this.glueSchemaRegistryConfiguration,
AWSSchemaRegistryGlueClientRetryPolicyHelper.getRetryPolicy());
Copy link
Author

Choose a reason for hiding this comment

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

retry policy will get automatically filled in by the less-telescoped constructor

@dbottini
Copy link
Author

One thing I'm noting here working with this repo is that there's a lot of redundant dependency declarations in the child poms, which leads to errors like leaving lombok as a runtime dependency when it wanted to be provided. I'm not going to boil the ocean in this PR, but did want to clean up lombok at least. I think in the long term, this repo should consider moving the "all children want this dependency" dependencies to a basic <dependency> block rather than <dependencyManagement> to reduce risk of similar errors in the future. Probably every compile-time library, like lombok, should just be globally provided and not included individually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants