-
Notifications
You must be signed in to change notification settings - Fork 77
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
Springwolf AMQP - more than one @RabbitHandler per @RabbitListener not permitted #285
Comments
Welcome to Springwolf. Thanks a lot for reporting your first issue. Please check out our contributors guide and feel free to join us on discord. |
Hi @unbearables, I used the latest springwolf version, and I was not able to reproduce your issue. Code added to the amqp example project to verify:
I noticed that we didn't support With the change, one channel |
Thank your for the report, the issue has been addressed in the new release. Feel free to reopen this issue if there is still something missing. |
Hi, I tested your version but the problem still persists. We have some custom annotations, which are deserializing based on routing keys - we put them directly on the dto class, therefore it's harder to pair this with binding. But mainly, I discovered that springwolf genereates wrong AsyncAPI doc. The problem is that springwolf uses queues as channels, but from what I found in AsyncAPI docs the routing keys are supposed to be channels. See example from AsyncAPI doc and AsyncAPI issue . Is this something you are aware of or do I misunderstand something? |
Hi @unbearables, Thank you for the feedback, I am not very familiar with amqp. I think you are right and at the same time, Springwolf is spec conform as long as no exchanges nor routing keys are used. In those cases, the queue name becomes the exchange name. But lets add support for amqp routing keys to support your use-case. @RabbitListener(
bindings = {
@QueueBinding(
exchange = @Exchange(name = "name", type = ExchangeTypes.TOPIC),
value = @Queue(name = "example-bindings-queue", durable = "false"),
key = "example-topic-routing-key")
}) [0] https://www.cloudamqp.com/blog/part4-rabbitmq-for-beginners-exchanges-routing-keys-bindings.html |
A new version of Springwolf has been released, hopefully resolving your issue. |
Describe the bug
Springwolf-amqp does not permit more than one
@RabbitHandler
per@RabbitListener
. Having 2 or more methods annotated with@RabbitHandler
causes springwolf to fail at https://github.com/springwolf/springwolf-core/blob/master/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/stavshamir/springwolf/asyncapi/scanners/channels/annotation/MethodLevelRabbitListenerScanner.java#L45 - where the.collect(Collectors.toMap(Binding::getDestination, Function.identity()));
throws, as there are more bindings with same destinationDependencies and versions used
springwolf-amqp
version0.8.1
springwolf-ui
version0.8.0
Code example
Stack trace and error logs
Suggestion
It seems that only destination is not enough of uniqueness for binding, as it should be identified by
destination + exchange + routingKey + arguments
(arguments for headers exchange). Going deeper, the methodMethodLevelRabbitListenerScanner.getExchangeName
counts with only 1 exchange per whole@RabbitListener
, but propertybindings
can be mapped to multiple exchanges. Is this a known/intended limitation?The text was updated successfully, but these errors were encountered: