-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Is your enhancement related to a problem? Please describe
The VertxHttpClientFactory provides a stub for adding more options. But unlike the other HttpClient implementations in the project, it is never called. I feel that it is never called because the VertxHttpClientBuilder doesn't force the Factory type like the others do and since the base HttpClient.Factory interface does not require an additionalConfig method to be implemented, there is no guarantee that the factory used for the builder provides such a method.
Describe the solution you'd like
A user leveraging the existing VertxHttpClientBuilder should have the ability to provide overrides for the underlying WebClientOptions. Vertx provides a lot of configuration knobs, and the defaults are not going to suit everyone.
Using the existing pattern of additionalConfig call from build() would be sweet, but I'm not sure that can be done without a breaking change. So short of that I'm proposing the idea of a base options object that can be provided to the builder. The build() method will use that base object if it was provided. This gives users the ability to modify vertx options if they so choose.
Describe alternatives you've considered
Stoping using generics for the Factory in VertxHttpClientBuilder and instead requiring the VertxHttpClientFactory (or extension of it). This could allow us to call the existing additionalConfig
method from the Builder.build().
The biggest reason against this is that it is a breaking change for any user not using the stock factory.
Additional context
I'm coming with this because we moved to vert.x HttpClient in Apache Druid. We were using okhttp in the past. Using vert.x we have found that the defaults around the idle timeouts in vert.x are not sufficient and we are running into instances where our KubernetesClient is trying to use connections that have been closed on the server side. We feel that vert.x should be more aggressively monitoring connection health and cleaning up closed connections. To achieve this we need access to override underlying vert.x options.