-
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
In Springwolf UI, add support for sending RabbitMQ Message towards an exchange using a RoutingKey #366
Comments
Thanks for this elaborate explanation. Basically you want to use springwolf-ui on microservice 1 to publish a message. It should take the info from Springwolf UI does not support this at this point.
Feel free to contribute this feature, we are happy to help. |
Just adding a link and a picture to illustrate the different kind of exchanges supported by RabbitMQ: src: https://hevodata.com/learn/rabbitmq-exchange-type/ So the 'complete chain' is: Producer > Channel > Exchange > Binding > Routing Key > Queue > Consumer |
I am not really sure of myself here, but still I do share some thoughts to try to move things forward. I had a look at the code and I think that maybe we could first change a bit the code without adding a new 'routingKey' attribute you mentioned. 1. What if we also add bindings here: Lines 81 to 83 in 1639a50
So we we would have something like
2. So ChannelBinding would be available for these 2 methods here Lines 54 to 80 in 1639a50
By doing this I think we should be able to deal with the type of If it's
and if it's
for the latter case, maybe we should be able to to specify / or to obtain from some place , the exchange, other than default exchange? 3. About existing annotations FYI, the method I am testing in the frame of this explanation has the following annotations
So, here, I am expecting SpringWolf UI to do this:
which is, with actual values :
but what I do observe is this:
so, routingKey is not 'taken from' AmqpAsyncOperationBinding.cc[0] 4. Possible or not ? What is your opinion on the idea presented here? ( Once done, we could could possibly think of a feature in SpringWolf UI which would be 'overwrite routingKey'. |
FYI, here is a screenshot of RabbitMQ management UI.
(The "Default exchange" then will 'route' the message to the queue) Notes
|
@timonback @sam0r040 |
Thanks for the PR @pdalfarr I guess we need to into the asyncapi docs how amqp is mapped to channels, particular routing keys. Line 44 in 86e3406
|
You are welcome. |
@timonback FYI, a guy from Modelina answered to my SO question here : https://stackoverflow.com/questions/78581918/async-api-bare-minimum-asyncapi-yaml-for-simple-rabbitlistener?noredirect=1#comment138573527_78581918 I think there is valuable information there for your springwolf-amqp plugin ;-) |
Thanks for the contact. I get the feeling that we need to deeply look into the amqp plugin implementation and how exchanges, routing keys and queues are mapped to asyncapi and springwolf. |
Relates to asyncapi/bindings#259 |
* tests: refactoring + add yaml endpoint testing * tests: additional RabbitListener tests * chore(amqp): fix queue configuration * chore(amqp): simplify local testing * chore: update asyncapi.yaml gradle script * feat(amqp): scan all queues In addition to the routingKeys * test(amqp): update asyncapi artifacts Part of GH-366 * test(ui): use valid mock data * chore(ui): fix formatting * test(amqp): update asyncapi artifacts * feat(ui): show channel bindings * test: add WaitStrategy for ApiSystemTest * chore(amqp): use non-exclusive queue in example * chore(amqp): use non-exclusive queue in example * test(amqp): persist patched asyncapi.yaml * chore(amqp): add spring-messaging dependency in example * test(amqp): wait for ready amqp server * test(amqp): update e2e * test(amqp): cleanup --------- Co-authored-by: Pascal Dal Farra <[email protected]>
test(amqp): update e2e test(amqp): wait for ready amqp server chore(amqp): add spring-messaging dependency in example test(amqp): persist patched asyncapi.yaml chore(amqp): use non-exclusive queue in example test: add WaitStrategy for ApiSystemTest feat(ui): show channel bindings test(amqp): update asyncapi artifacts chore(ui): fix formatting test(ui): use valid mock data test(amqp): update asyncapi artifacts Part of springwolfGH-366 feat(amqp): scan all queues In addition to the routingKeys chore: update asyncapi.yaml gradle script chore(amqp): simplify local testing chore(amqp): fix queue configuration tests: additional RabbitListener tests tests: refactoring + add yaml endpoint testing
* tests: refactoring + add yaml endpoint testing * tests: additional RabbitListener tests * chore(amqp): fix queue configuration * chore(amqp): simplify local testing * chore: update asyncapi.yaml gradle script * feat(amqp): scan all queues In addition to the routingKeys * test(amqp): update asyncapi artifacts Part of springwolfGH-366 * test(ui): use valid mock data * chore(ui): fix formatting * test(amqp): update asyncapi artifacts * feat(ui): show channel bindings * test: add WaitStrategy for ApiSystemTest * chore(amqp): use non-exclusive queue in example * chore(amqp): use non-exclusive queue in example * test(amqp): persist patched asyncapi.yaml * chore(amqp): add spring-messaging dependency in example * test(amqp): wait for ready amqp server * test(amqp): update e2e * test(amqp): cleanup --------- Co-authored-by: Pascal Dal Farra <[email protected]>
Describe the feature request
In Springwolf UI, add support for sending RabbitMQ Message towards an exchange using a Routing Key.
Motivation
Springwolf is able to list all the Publishers and Subscribers and present a UI which, not only list these, but also allow to test them by sending message.
Regarding RabbitMq, this 'message sending' feature is working fine for RabbitMQ QUEUES, but does not work for EXCHANGE.
This feature request aims to implements this missing part.
Technical details
Here are some technical details I gathered so far:
The springwolf UI allows to send messages to QUEUES (when plugin.amqp.publishing.enabled: true )
which is OK when specifying queue name in AsyncOperation.channelName
But sending a message to a TOPIC (exchange) is not working as expected:
Let's take an example:
In one of the RabbitMQ your example, here
https://github.com/springwolf/springwolf-core/blob/master/springwolf-examples/springwolf-amqp-example/src/main/java/io/github/stavshamir/springwolf/example/amqp/producers/ExampleProducer.java#L17-L28
we have:
Now, let's suppose we have, in another micro-service, a method with the following annotation:
So, this microservice2 does declare a topic which receives messages send by the RabbitMQ 'sample' code :
rabbitTemplate.convertAndSend("example-topic-exchange", "example-topic-routing-key", dto);
This is working fine, BUT, when using the Springwolf UI, it does not work.
It seems that messages sent from the UI goes to a QUEUE named "example-producer-channel-publisher" along with a routing-key with the same value, i.e. "example-producer-channel-publisher"
Ideas:
Maybe we could make use of amqpchannelbinding to express the fact that we want 'the UI' to send message towards a given exchange (a topic in my example), along with a routing key ?
In the example I gave here, your code (micro-service 1) is sending a message to a topic (rabbitTemplate.convertAndSend("example-topic-exchange", "example-topic-routing-key", dto);
).
Of course, I do NOT want the "microservice-2-private-queue-name" queue name (from micro-service 2) to be known by the AsyncPublisher annotation of micro-service 1.
And I want my microservice-2 being able to change 'at will' the name of it's own internal/private queue.
microservice-1should only know about the exchange+routing-key of micro-service 2.
In other words, microservice-1, must send message to this (let's say public) exchange, and this is what is actually done in the code.
So I guess this should be reflected in the annotation, as well as in the behavior of Springwolf UI.
I tested this on my side in my project, and the messages send from the UI get delivered to micro-service 2 if I set, in micro-service 1, the channelName to "microservice-2-private-queue-name".
Describe alternatives you've considered
I haven't considered any alternatives yet.
The text was updated successfully, but these errors were encountered: