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

Fix #40 to support rest client #41

Merged
merged 4 commits into from
Nov 29, 2024
Merged

Conversation

zhfeng
Copy link
Contributor

@zhfeng zhfeng commented Nov 28, 2024

I have to disable the native test on testClient currently and will open an issue to investigate it.

@zhfeng zhfeng requested a review from a team as a code owner November 28, 2024 09:47
@zhfeng
Copy link
Contributor Author

zhfeng commented Nov 28, 2024

The classic-resteasy-client is failing with

jakarta.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: jakarta.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/fury type: io.quarkiverse.fury.it.Bar
	at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:365)
	at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:427)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:134)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:103)
	at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:102)
	at jdk.proxy2/jdk.proxy2.$Proxy101.bar(Unknown Source)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at org.jboss.resteasy.microprofile.client.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:152)
	at jdk.proxy2/jdk.proxy2.$Proxy102.bar(Unknown Source)
	at io.quarkiverse.fury.it.FuryTest.testRestClient(FuryTest.java:61)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:806)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: jakarta.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type application/fury type: io.quarkiverse.fury.it.Bar
	at org.jboss.resteasy.core.interception.jaxrs.ClientWriterInterceptorContext.throwWriterNotFoundException(ClientWriterInterceptorContext.java:48)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.getWriter(AbstractWriterInterceptorContext.java:278)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.syncProceed(AbstractWriterInterceptorContext.java:219)
	at org.jboss.resteasy.core.interception.jaxrs.AbstractWriterInterceptorContext.proceed(AbstractWriterInterceptorContext.java:207)
	at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.writeRequestBody(ClientInvocation.java:387)
	at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.writeRequestBodyToOutputStream(ManualClosingApacheHttpClient43Engine.java:579)
	at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.buildEntity(ManualClosingApacheHttpClient43Engine.java:548)
	at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.loadHttpMethod(ManualClosingApacheHttpClient43Engine.java:486)
	at org.jboss.resteasy.client.jaxrs.engines.ManualClosingApacheHttpClient43Engine.invoke(ManualClosingApacheHttpClient43Engine.java:345)
	... 13 more

I tried to add FurySerializer in the reflective classes but it seems not work.

The reactive-rest-client is failing with

java.lang.IllegalStateException: No RestClientBuilderResolver implementation found!
	at org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver.instance(RestClientBuilderResolver.java:81)
	at org.eclipse.microprofile.rest.client.RestClientBuilder.newBuilder(RestClientBuilder.java:54)
	at io.quarkiverse.fury.it.FuryTest.testRestClient(FuryTest.java:59)
	at java.base/java.lang.reflect.Method.invoke(Method.java:580)
	at io.quarkus.test.junit.QuarkusTestExtension.interceptTestMethod(QuarkusTestExtension.java:806)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)

I'm not sure how to fix it.

@geoand any hint?

Comment on lines +97 to +109
private void registerHandler(RuntimeType type,
BuildProducer<MessageBodyReaderBuildItem> additionalReaders,
BuildProducer<MessageBodyWriterBuildItem> additionalWriters) {
additionalReaders.produce(new MessageBodyReaderBuildItem.Builder(
ReactiveFurySerializer.class.getName(), Object.class.getName())
.setMediaTypeStrings(List.of("application/fury", "application/*+fury"))
.setRuntimeType(type)
.setBuiltin(true).build());
additionalWriters.produce(new MessageBodyWriterBuildItem.Builder(
ReactiveFurySerializer.class.getName(), Object.class.getName())
.setMediaTypeStrings(List.of("application/fury", "application/*+fury"))
.setRuntimeType(type)
.setBuiltin(true).build());
Copy link

Choose a reason for hiding this comment

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

ReactiveFurySerializer is a server part, so it won't work for the client

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, but it still implements both MessageBodyReader and MessageBodyWriter.

Copy link

Choose a reason for hiding this comment

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

Oh, I didn't see that

Comment on lines 87 to 88
resteasyJaxrsProviderBuildItemBuildProducer
.produce(new ResteasyJaxrsProviderBuildItem(FurySerializer.class.getName()));
Copy link

Choose a reason for hiding this comment

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

I am not sure if this is enough for RESTEasy Classic. You probable also have to use META-INF/services/jakarta.ws.rs.ext.Providers like RESTEasy does in the resteasy-json-binding-provider module for example

@zhfeng zhfeng merged commit 4ccad05 into quarkiverse:main Nov 29, 2024
1 check passed
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