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

Register subclasses MessageCodec for EventBus usage #16103

Closed
flupec opened this issue Mar 29, 2021 · 4 comments · Fixed by #29560
Closed

Register subclasses MessageCodec for EventBus usage #16103

flupec opened this issue Mar 29, 2021 · 4 comments · Fixed by #29560
Assignees
Labels
area/vertx kind/bug Something isn't working
Milestone

Comments

@flupec
Copy link

flupec commented Mar 29, 2021

Describe the bug

The problem is that quarkus does not handle the case when a subtype of the type declared in the method is passed to the method. Quarkus registers Message Codec's only specifically for classes declared with @ConsumeEvent annotation.

Expected behavior

LocalEventBusCodec must be registered for all subtypes of parameter type from method that is annotated with@ConsumeEvent

Actual behavior

Currently, LocalEventBusCodec registered only for concrete classes from method parameter.

To Reproduce

Steps to reproduce the behavior:

  1. Create two classes, for example:
public class Event {
    String a;
}

public class SubClassEvent extends Event {}
  1. Declare event consumer method, for example:
@ConsumeEvent("address")
void handle(Event event) {}
  1. Send or publish object of SubClassEvent type via EventBus and see following message: java.lang.IllegalArgumentException: No message codec for type: SubClassEvent

Quarkus version or git rev

1.11.1.Final

Additional context

I think the problem is in following implementation: EventBusCodecProcessor

@flupec flupec added the kind/bug Something isn't working label Mar 29, 2021
@flupec
Copy link
Author

flupec commented Mar 30, 2021

Here is simple reproducer

@gsmet
Copy link
Member

gsmet commented Nov 29, 2022

Looks like this one fell through the cracks. I created #29560 to fix it.

@gsmet
Copy link
Member

gsmet commented Nov 29, 2022

@flupec thanks for the reproducer, btw!

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

Successfully merging a pull request may close this issue.

3 participants