Skip to content

Conversation

@capistrant
Copy link

fixes #7252

Description

Align vert.x with the other supported Http clients in the area of supporting calling additionalConfig from the associated Builder, allowing users of the client to do some customization of the base config for the client. Since the vert.x client does not strictly type the factory used by the builder like the other supported clients do, I added type check to only call additionalConfig when the factory in use is the base VertxHttpClientFactory. This is not ideal, but since the underlying HttpClient.Factory interface does not have additionalConfig in the contract, I don't think there is much we can do that would not be a breaking change, without explicitly checking the factory type.

I had proposed #7315 as an alternative non-breaking change to this issue, but since that did not get much traction, I wanted to see if there is more appetite for this. I think giving this flexibility to clients using vert.x would be very useful for folks wanting a bit more customization capability like they get with the other backing http clients.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change
  • Chore (non-breaking change which doesn't affect codebase;
    test, version modification, documentation, etc.)

Checklist

  • Code contributed by me aligns with current project license: Apache 2.0
  • I Added CHANGELOG entry regarding this change
  • I have implemented unit tests to cover my changes
  • I have added/updated the javadocs and other documentation accordingly
  • No new bugs, code smells, etc. in SonarCloud report
  • I tested my code in Kubernetes
  • I tested my code in OpenShift

Copy link
Contributor

@shawkins shawkins left a comment

Choose a reason for hiding this comment

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

Thank you @capistrant this looks good to me.

@manusa this should be ready to merge.

});
}

// Since the factory is not explicitly typed as VertxHttpClientFactory, we need to check the type before invoking
Copy link
Contributor

Choose a reason for hiding this comment

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

It's perfectly fine to do this instanceOf check. Quarkus is using their own factory type with this builder.

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative to make this available to other factories is to introduce an interface for this specific additionalConfig method signature.

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.

Vert.x HttpClient should provide ability to customize WebClientOptions

2 participants