-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
feat: add amqp exchange routing pattern and ref in channel operation #259
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
@timonback this repo is destination point Start from creating PR in schemas repo - https://github.com/asyncapi/spec-json-schemas/tree/master/bindings/amqp Create new version 0.4.0 and change schema |
Thank you @Pakisan for the pointing out the correct repo. I re-created this PR as asyncapi/spec-json-schemas#555 |
@jonaslagoni @dalelane @smoya @GreenRover please, take a look this PR is ready asyncapi/spec-json-schemas#555 |
up |
Sorry my knowledge about amqp is very low, i am not sure if i can help. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review @timonback
I love the work you're doing with Springwolf!
I have some general comments except for the inline ones I left in a PR:
- would be good if you could update the example from PR description with the new binding (adding some inline comment about the new addition) to visualize the added change
- since new fields are added to the binding, it also means you need to update the version value in the README.md - same to do in json schema
- for the sake of consistency, please have a look on how
exchange
object is defined. First theMap
is described and then specific properties, likename
andtype
. Please follow the same approach with newchannel
option. Although in your case it is even easier aschannel
will be of typeReference Object
like in https://github.com/asyncapi/spec/blob/master/spec/asyncapi.md#operation-reply-object - make it clear in description that we are talking about AsyncAPI channel only, and
$ref
only. Have a look at how we do it in case of channel reference inreply object
.
also cc @jonaslagoni that did a migration of the binding to v3, maybe he also have something to add
amqp/README.md
Outdated
@@ -54,6 +56,9 @@ channels: | |||
bindings: | |||
amqp: | |||
is: routingKey | |||
name: routing.pattern |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
technically shouldn't there be something matching this name in the userSignup
to make this example make sense?
@derberg did not go into specifics of whether something made sense for AMQP, so I will stay out of the specifics :) Already reviewed asyncapi/spec-json-schemas#555 |
Thank you for the review @derberg! I have updated the PR to:
Example: This proposal adds a 1:1 mapping between exchange and queue to indicate and thereby implementing the simple TopicExchange case. Based on the amqp implemention in Spring Boot, it is possible that 1 exchange routes to multiple different queues using different routing keys (i.e. topic exchange Similarly, an exchange may have multiple amqp bindings. For example, an exchange can be of |
@timonback not sure I get it, but if you say that an exchange can have routingKey pointing to multiple channels, why not making look at this example from the spec: https://www.asyncapi.com/docs/reference/specification/v3.0.0#channelObject where you can specify that channel is available only on specific servers, notice that one can specify |
Hi everyone, I have be asked by @timonback to "give some clarity to #259 and how exchanges and queues are connected in amqp? (is it a n:m mapping?)" I am not really an expert, but I'll try ;-) "
Regarding the n:m mapping: Yes, it is possible to have an n:m mapping between exchanges and queues. This answer is 'in line' with my current understanding of how exchanges, bindings and queues are linked together. I also add a copy of a comment I posted on SpringWolf's Github about that: " src: https://hevodata.com/learn/rabbitmq-exchange-type/ So the 'complete chain' is: Producer > Channel > Exchange > Binding > Routing Key > Queue > Consumer So, theoretically, I think that we could have:
I don't know if it's good practice or not, but I suppose it's a valid use case. |
Thank you @pdalfarr for this explanation and pictures. I'll attempt to summarize this GH issue
For details, check @pdalfarr comment above: #259 (comment) Original issueIt would be great to have a way to describe, how messages are routed on the broker Initial idea/improvementAllow to link a Problem:
Also, how to translate amqp AlternativeRather use the What are your thoughts? (As I am not familiar enough with amqp, I cannot and do not plan a re-design of the amqp binding. If it turns out, that the use case is a non-goal or design limitation, that is fine with me.) |
great summary @timonback I only do not understand what you mean by
also lemme explain below a bit more:
yes, one channel one binding, but AsyncAPI Channel is not necessarily 1:1 mapping with a real channel in the broker. With AsyncAPI v3 channel address is no longer an identifier of the channel. This means you can have multiple channels with the same address. You can for example model something like https://www.asyncapi.com/docs/concepts/asyncapi-document/reply-info#multiple-channels-with-single-message-when-reply-address-is-known with AsyncAPI v3 |
Description
In Java Spring applications, it is possible to define an application that connects to an amqp broker, defines exchanges, queues and listens to incoming message on these queues.
My current understanding of amqp:
In AsyncAPI, the amqp binding supports two types of channels: routingKey (which is an exchange) and queue.
Unfortunately, there is no link between the two.
Proposal:
Add (optional) fields:
name
to specify the actual routing pattern used (in the (topic) exchange or amqp binding)channel.$ref
to connect theis=routingKey
channel type to theis=queue
channel type.I am looking forward to your thoughts.
Example: