-
-
Notifications
You must be signed in to change notification settings - Fork 273
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: assign channels to servers #531
feat: assign channels to servers #531
Conversation
While keeping the meaning of the AsyncAPI spec entirely unchanged, i've added clarifying statements on the meaning of the `publish` and `subscribe` operations.
update from upstream
updating
I like the approach of using labels here. In fact, It made me think about Kubernetes labels and selectors. |
@smoya I think going the same path as k8s is a bit of a premature optimization for now IMHO. AFAIK, nobody has asked for a more sophisticated mechanism, and adding it will introduce potentially unnecessary complexity to the spec. |
@GeraldLoeffler could you clarify more about why it is Server and Channel relation and not Server and Message relation? There is a use case that one channel can have multiple messages on a given operation ( Another suggestion from my side would be a bit more modification on the example. Now Another thinking exercise is: at first sight Sorry for all these challenges 😅 Huge additional request, please explicitly mention this PR as a comment in all the linked issues so people that are interested the most are notified. |
it was simply a question of modelling the most obvious association, the one between server and channel:
So far in the spec it was assumed that in the scope of a given AsyncAPI document, all channels are available on all servers. I'm trying to relax that requirement. You are saying that the same channel may exist on several servers, but some messages may only be sent/received via that channel to/from a subset of those servers. True, that can happen too, but i didn't have the need to model that and so it's not in my proposal. If we wanted to include it we would need an optional |
agreed, the examples could be better: happy to refine them once we have agreement on the approach. |
your proposal is to bind channels to servers by explicitly listing all servers to which a channel applies. This is certainly possible, but cumbersome in the typical case of having many environments. For example, for a protocol translator from
versus
I think this example shows the tradeoff between the two approaches. |
Would it make sense to add, instead, an extra link between Servers and Operations? This is something we have considered when designing the new Intent-driven API for the Parser(s). See https://github.com/asyncapi/parser-api/blob/master/docs/v1.md#operation. However, having several resources linking to servers can introduce issues such as mutual exclusion. What if a channel specifies its relation to some servers but their operations are linked to others? |
Calling all interested parties to please support one of the following proposals on this topic:
In addition, there were proposal to go beyond the association of channels to servers:
Proposals 4. and 5. are additional associations. So the mechanism (string labels, key-value-pair labels, or direct reference) to link to servers in 4. and 5. should match whatever is chosen to link channels to servers. I therefore propose to cover 4.-5. by a separate PR and focus here on 1.-3. . Please vote on 1., 2., or 3., and also state your support for 4. and/or 5. (@smoya, @derberg, @fmvilas). |
Rather consider the association of an operation with a server as optional because it is not the general case. Indeed, an operation should (and it is) be associated with a message which can be exchanged with one or several servers... in my opinion. |
See also a similar request for OpenAPI to define reusable sets of parameters (or parameter sets). There may be some ideas presented there that you can use to refine this feature proposal. I.e. labels are juts one way to define a set of servers (all servers sharing a label constitute a server set), and you want to be able to apply or associate a channel to one or more server sets. |
@GeraldLoeffler I think it is hard to perform any voting if there are still some unknowns.
I think good example is necessary for others to follow proposal
The advantage is that you have validation out of the box, parsing fails if you want to parse outdated reference. With labeling, one can change a label on a channel to a name that is not on the server list. Of course this could also be validated but therefore needs to be specified in the spec so parser know it is mandatory to implement. Can you provide a full example of AsyncAPI file with thes new properties. I'd like to have a closer look on a real use case and see how it works for websocket. We have over representation of people supporting concepts with broker in the middle and I just want to explore how this would work for websocket, if this is of any use actually.
Let's drop it. I see this in websockets only and for the server code generation where in fact in my opinion this should be really solved by having 2 separate spec documents, with external common parts |
@derberg @smoya , @fmvilas : going the path of least resistence here and adopting @derberg's proposal, i.e., associating channels to servers by referring to the servers directly, without any labels. This works and is the simplest possible solution. Have also added a (i think) convincing example:
Please review https://github.com/asyncapi/spec/pull/531/files and approve. |
@derberg : rebased to release branch - done |
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.
A reference implementation in JSON Schema and Parser are already released in individual release candidates. I changed this proposal to Stage 3.
There is one error IMHO here in this PR, please have a look at the individual comment to markdown file cc @fmvilas @magicmatatjahu
@GeraldLoeffler fyi we cannot make fixes on our own as you did PR from some kind of org-level fork and we do not have rights as maintainer to push to this PR. |
Co-authored-by: Lukasz Gornicki <lpgornicki@gmail.com>
Kudos, SonarCloud Quality Gate passed! |
i accepted your suggestion and gave you write access to my repo. |
@GeraldLoeffler perfect, the only part that is missing is updated description that reflects what is actually implemented |
done |
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.
👏🏼
🎉 This PR is included in version 2.2.0-2021-09-release.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Super happy to see this merged 👏 |
🎉 This PR is included in version 2.2.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
title: "Assign channels to servers through their names"
Add
servers
field to channel items, so that channels can be assigned to a sub-set of servers using the names of those servers. (A server's name is the string key used for defining that server in the top-levelservers
object.)Solves the issues discussed in the related issues:
Related issue(s):
#244
#255
#475