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

Unable to supply ClientHttpEngine to RestEasy Reactive Client #34969

Closed
chonton opened this issue Jul 24, 2023 · 2 comments
Closed

Unable to supply ClientHttpEngine to RestEasy Reactive Client #34969

chonton opened this issue Jul 24, 2023 · 2 comments
Labels
area/rest kind/bug Something isn't working

Comments

@chonton
Copy link
Contributor

chonton commented Jul 24, 2023

Describe the bug

Using RestEasy client I can use the following code as documented in RESTEasy ClientHttpEngine implementations:
ResteasyClient client = ((ResteasyClientBuilder)ClientBuilder.newBuilder()).httpEngine(myEngine).build();

When using resteasy reactive, this code throws an exception: java.lang.ClassCastException: class org.jboss.resteasy.reactive.client.impl.ClientBuilderImpl cannot be cast to class org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder (org.jboss.resteasy.reactive.client.impl.ClientBuilderImpl and org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder are in unnamed module of loader 'app'

Expected behavior

I desire to configure ClientHttpEngine with retry options

Actual behavior

ClassCastException

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

Probably want to port the custom quarkus versions of resteasy jars back to the resteasy project.

@chonton chonton added the kind/bug Something isn't working label Jul 24, 2023
@quarkus-bot
Copy link

quarkus-bot bot commented Jul 24, 2023

/cc @FroMage (resteasy-reactive), @Sgitario (resteasy-reactive), @geoand (resteasy-reactive), @stuartwdouglas (resteasy-reactive)

@Sgitario
Copy link
Contributor

You're trying to use internal implementations from the REST Client Classic (((ResteasyClientBuilder)ClientBuilder.newBuilder()).httpEngine(myEngine) in REST Client Reactive (which internally is using very different components, e.g. the Vert.x HTTP Client).
Therefore, this is not going to work and can't be supported.

In REST Client Reactive, you can configure the internal HTTP Client by providing a custom HTTP options instance as described in here.

If what you want to achieve is to implement retries, you can annotate the REST Client interface (or the methods) with the @Retry annotation:

@RegisterRestClient(configKey = "my-api")
@Retry(delay = 1, delayUnit = ChronoUnit.SECONDS, maxRetries = 5)
public interface MyRestClient {
 ....
}

You can find more information about this annotation in the Smallrye Fault Tolerance Quarkus extension: https://quarkus.io/guides/smallrye-fault-tolerance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants