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

Eventbus, No message codec for type when using headers #30417

Closed
computerlove opened this issue Jan 17, 2023 · 0 comments · Fixed by #30449
Closed

Eventbus, No message codec for type when using headers #30417

computerlove opened this issue Jan 17, 2023 · 0 comments · Fixed by #30449
Labels
kind/bug Something isn't working
Milestone

Comments

@computerlove
Copy link
Contributor

Describe the bug

When a event class is only consumed by @ConsumeEvent methods with signature

@ConsumeEvent(value = "address")
public void listen(MultiMap headers, Body body) {
        ... 
}

no message codec is regisered for this class.
Resulting in

java.lang.IllegalArgumentException: No message codec for type: class org.acme.Hello
	at io.vertx.core.eventbus.impl.CodecManager.lookupCodec(CodecManager.java:119)
	at io.vertx.core.eventbus.impl.EventBusImpl.createMessage(EventBusImpl.java:254)
	at io.vertx.core.eventbus.impl.EventBusImpl.publish(EventBusImpl.java:164)
	at io.vertx.core.eventbus.impl.EventBusImpl.publish(EventBusImpl.java:159)
	at org.acme.GreetingResource.hello(GreetingResource.java:23)
	at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

Adding another method without headers will register a codec.

Expected behavior

Message codecs are created on startup regardless of whether the event consumers include headers.

Actual behavior

No message codecs are created, resulting in

java.lang.IllegalArgumentException: No message codec for type: class org.acme.Hello
	at io.vertx.core.eventbus.impl.CodecManager.lookupCodec(CodecManager.java:119)
	at io.vertx.core.eventbus.impl.EventBusImpl.createMessage(EventBusImpl.java:254)
	at io.vertx.core.eventbus.impl.EventBusImpl.publish(EventBusImpl.java:164)
	at io.vertx.core.eventbus.impl.EventBusImpl.publish(EventBusImpl.java:159)
	at org.acme.GreetingResource.hello(GreetingResource.java:23)
	at org.acme.GreetingResource$quarkusrestinvoker$hello_e747664148511e1e5212d3e0f4b40d45c56ab8a1.invoke(Unknown Source)
	at org.jboss.resteasy.reactive.server.handlers.InvocationHandler.handle(InvocationHandler.java:29)
	at io.quarkus.resteasy.reactive.server.runtime.QuarkusResteasyReactiveRequestContext.invokeHandler(QuarkusResteasyReactiveRequestContext.java:114)
	at org.jboss.resteasy.reactive.common.core.AbstractResteasyReactiveContext.run(AbstractResteasyReactiveContext.java:145)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:576)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

How to Reproduce?

https://github.com/computerlove/quarkus-evenbus-headers-reproducer
Start with mvn quarkus:dev and GET http://localhost:8080/hello
Exception will be printed in terminal.
Commenting in the extra listener, listenNoHeaders, in Listener.java will result in the expected behaviour.

Output of uname -a or ver

No response

Output of java -version

java 17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.15.3

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

No response

Additional information

No response

@computerlove computerlove added the kind/bug Something isn't working label Jan 17, 2023
@quarkus-bot quarkus-bot bot added this to the 2.17 - main milestone Jan 20, 2023
ebullient pushed a commit to maxandersen/quarkus that referenced this issue Jan 24, 2023

Verified

This commit was signed with the committer’s verified signature.
ebullient Erin Schnabel
…ixes quarkusio#30417
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant