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

FEATURE: base feign-vertx on Vertx WebClient instead of bare vertx #2756

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hosuaby
Copy link
Contributor

@hosuaby hosuaby commented Feb 6, 2025

I made a number of changes to feign-vertx module:

  • Switch from bare vertx to high level WebClient. It will give the user more configuration options, including the possibility of enabling OAuth2/OIDC authentication (cause feign-vertx and feign-oauth2 are not and cannot be compatible).
  • More reliable tests.
  • Ensured compatibility with Vertx 5.

@hosuaby hosuaby force-pushed the feature/vertxOauth2 branch 4 times, most recently from 8c66ab1 to f971942 Compare February 7, 2025 11:00
@hosuaby hosuaby force-pushed the feature/vertxOauth2 branch from f971942 to d7adeba Compare February 7, 2025 18:53
Copy link
Member

@velo velo left a comment

Choose a reason for hiding this comment

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

I think for tests you could keep them all on feign-vertx, generate the test-jar there, and on feign-vertx5-test you just extend the same tests under feign.vertx5 package....

Then you can make the module a top level project and if eventually vext breaks compatibility we can have multiples like we do with jax-rs

* @return this builder
*/
public Builder vertx(final Vertx vertx) {
Copy link
Member

Choose a reason for hiding this comment

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

My main concern about this change is breaking compatibility with previous version.

Would it be possible to keep this (probably as deprecate) and run WebClient.create(vertx)

Then we can instruct to use the new method and mark for removal on next major release

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need for that. Because we never released the current version. The previous is still available, by the way, in the separate project that was merged into the main project recently.

Comment on lines -267 to -292
* Sets request options using Vert.x {@link HttpClientOptions}.
*
* @param options {@code HttpClientOptions} for full customization of the underlying Vert.x
* {@link HttpClient}
* @return this builder
*/
public Builder options(final HttpClientOptions options) {
this.options = checkNotNull(options, "Argument options must be not null");
return this;
}

/**
* Sets request options using Feign {@link Request.Options}.
*
* @param options Feign {@code Request.Options} object
* @return this builder
*/
@Override
public Builder options(final Request.Options options) {
checkNotNull(options, "Argument options must be not null");
this.options =
new HttpClientOptions()
.setConnectTimeout(options.connectTimeoutMillis())
.setIdleTimeout(options.readTimeoutMillis());
return this;
}
Copy link
Member

Choose a reason for hiding this comment

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

Same as above, is it possible to keep as deprecated!?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idem. Current version from core project was never released.

* </pre>
*
* @param requestPreProcessor operation to execute on each request
* @return updated request
*/
public Builder requestPreProcessor(UnaryOperator<HttpClientRequest> requestPreProcessor) {
Copy link
Member

Choose a reason for hiding this comment

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

the ask here would be the same, not sure if viable at all

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idem. Current version from core project was never released.

Comment on lines -59 to -62
final Vertx vertx,
final HttpClientOptions options,
final WebClient webClient,
final long timeout,
final UnaryOperator<HttpClientRequest> requestPreProcessor) {
Copy link
Member

Choose a reason for hiding this comment

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

And lastly here too, keep old constructor, deprecate it, add new one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idem. Current version from core project was never released.

<jackson.version>2.18.2</jackson.version>
<slf4j-log4j12.version>2.0.0-alpha6</slf4j-log4j12.version>
<wiremock.version>2.35.2</wiremock.version>
<main.java.version>11</main.java.version>
Copy link
Member

Choose a reason for hiding this comment

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

is this needed?!

11 is the min version already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will check for it. Thanks

Comment on lines +32 to +34
<module>tests-vertx4</module>
<module>tests-vertx-common</module>
<module>tests-vertx5</module>
Copy link
Member

Choose a reason for hiding this comment

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

nice effort on test coverage 🥇

Copy link
Member

Choose a reason for hiding this comment

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

I think we can just call them feign-vertx*-test

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the suggestion. I will study them carefully and see how I can improve tests. The most important is to avoid to produce the jar and run tests at same build. By doing so we will not be able to detect runtime binary uncompatibilities with different versions of Vertx (that arise quite offten).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice effort on test coverage 🥇

Thanks! feign-vertx is a 10-year-old project. It had plenty of time to be tested in productions and covered with tests for the most of frequent problems.

import org.junit.jupiter.api.Test;

@DisplayName("When server ask client to retry")
class RetryingTest extends AbstractFeignVertxTest {
Copy link
Member

Choose a reason for hiding this comment

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

These look to be exactly the same

https://github.com/OpenFeign/feign/pull/2756/files#diff-618b10051163eb35607cd662bc192620411ccce4da0be7a99ee6dfb0b0ee4ad9L50

Why not move to test commons and just have a simplified version here?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Some suggestions could not be made:

  • annotation-error-decoder/pom.xml
    • lines 49-48
  • apt-test-generator/pom.xml
    • lines 62-61
  • benchmark/pom.xml
    • lines 70-69
  • core/pom.xml
    • lines 37-36
  • googlehttpclient/pom.xml
    • lines 54-53
  • hc5/pom.xml
    • lines 67-66
  • httpclient/pom.xml
    • lines 75-74
  • hystrix/pom.xml
    • lines 78-77
  • jackson-jaxb/pom.xml
    • lines 82-83
  • java11/pom.xml
    • lines 50-49
  • jaxb-jakarta/pom.xml
    • lines 55-57
  • jaxb/pom.xml
    • lines 45-49
  • jaxrs2/pom.xml
    • lines 103-102
  • jaxrs3/pom.xml
    • lines 89-88
  • jaxrs4/pom.xml
    • lines 83-82
  • kotlin/pom.xml
    • lines 71-70
  • okhttp/pom.xml
    • lines 59-58
  • pom.xml
    • lines 601-602
  • reactive/pom.xml
    • lines 98-97
  • ribbon/pom.xml
    • lines 83-82
  • soap-jakarta/pom.xml
    • lines 63-62
    • lines 79-81
  • soap/pom.xml
    • lines 55-60
    • lines 70-71

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