-
-
Notifications
You must be signed in to change notification settings - Fork 269
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
Remote and local servers #689
Comments
There was so much editing in the original issue that I think I forgot to update it but I'm all in with proposal 2, having two root objects: |
I started reading your various discussions on version 3 and I find it very refreshing that everything is discussed openly! The recordings of your meetings on youtube really help! I would like to add my 2¢ on the naming of To increase reusability, the default would be that servers defined under Here is an example: # common.yaml
asyncapi: 3.0.0
components:
servers:
websocketServer:
url: ws://mycompany.com/ws
protocol: ws
mosquitto:
url: mqtt://test.mosquitto.org
protocol: mqtt
bindings:
mqtt:
clientId: websocketServer # backend.yaml
asyncapi: 3.0.0
info:
title: Website Backend
version: 1.0.0
servers:
websiteWebSocketServer:
$ref: 'common.yaml#/components/servers/websocketServer'
mosquitto:
$ref: 'common.yaml#/components/servers/mosquitto'
providedServers:
- websiteWebSocketServer
# ... # frontend.yaml
asyncapi: 3.0.0
info:
title: Website WebSocket Client
version: 1.0.0
servers:
websiteWebSocketServer:
$ref: 'common.yaml#/components/servers/websocketServer'
# ... |
@thake Thanks for that comment! Interesting idea, because then we can easily validate duplication of servers in groups local/provided and remote/used. However I think that people will have problem with this approach that servers by default are "used" and by defining # backend.yaml
asyncapi: 3.0.0
info:
title: Website Backend
version: 1.0.0
servers:
websiteWebSocketServer:
$ref: 'common.yaml#/components/servers/websocketServer'
mosquitto:
$ref: 'common.yaml#/components/servers/mosquitto'
usedServers:
- mosquitto
providedServers:
- websiteWebSocketServer
# frontend.yaml
asyncapi: 3.0.0
info:
title: Website WebSocket Client
version: 1.0.0
servers:
websiteWebSocketServer:
$ref: 'common.yaml#/components/servers/websocketServer'
usedServers:
- websiteWebSocketServer but that's my thought :) |
@magicmatatjahu thanks for your quick feedback! I took a liking to @smoya's statement in the 1st proposal in which he defined every server to be |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Example of a use case: so according to our use case #689 (comment) this looks better. |
Alright, taking care of this issue now. Will be moving it forward in the next weeks. Thanks a lot for the great input @smoya @thake @magicmatatjahu @Souvikns. I'll come up with a formal proposal soon. |
Alright, so I got a proposal but I have some concerns. Would be awesome to get your input :) #874 |
This issue has been automatically marked as stale because it has not had recent activity 😴 It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation. There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model. Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here. Thank you for your patience ❤️ |
Context
This is part of the RFC #618 (comment).
In an effort around reducing the scope of such RFC, it has been split into several proposals so they can move forward independently.
This fact is already being considered in The many meanings of an AsyncAPI file, and this proposal is not going through all the details that issue does regarding the semantics of the AsyncAPI file.
It focuses on solving perspectives when it comes to Servers, essential when generating code from an AsyncAPI file. For example, generating a Websocket server might be problematic if there is no distinction between those ports the application listens to and which remote servers the application connects to.
Now that Allow servers and channels to be defined inside components will be included in the
2.3.0
version of the spec; this proposal makes more sense than ever as it enhances the way we define and share servers.The proposal
This proposal introduces remote and local servers.
There are several ways to portray this new concept into an AsyncAPI file, and the idea is that we can all find out which one fits better (or rather discard all, suggest new ones, etc.).
Proposal 1: Introduce a new
kind
property on the Server objectServers get a new
kind
property. By default, all servers are remote servers (e.g., brokers).However, if the
kind
property is set tolocal
, that means the application actually exposes the server (e.g., WebSocket or HTTP Server-Sent Events server).Example:
This option is the less intrusive one as it only requires a new property to be added to the Server object.
This is very important since improving the Developer Experience is one of the main goals of the AsyncAPI Initiative's roadmap.
However, it penalizes Server's shareability by not allowing to overwrite
kind
property when using$ref
.In the following example (adapted from our official social-media example), there is a
backend
service that connects to a remote MQTT broker, but also exposes a websocket server. Then afrontend
service connects to that websocket server exposed by thebackend
service.Proposal 2: Split current
servers
intoremotes
andservers
servers
field, at root AsyncAPI document level, are split intoremotes
andservers
based on their nature, meaningservers
will be considered as local servers, andremotes
(as the name indicates), remote servers.However, servers declared inside
components
will all live underservers
as they can't predict their nature. And here it is the benefit of this approach. Let's see it with the following example:As we can see, the reusability of the same server is much easier. However, it can also penalize Developer Experience:
remotes
? What areservers
? How can we explain that to people that come from2.x
or even new users? It is not as intuitive as it might sound.2.x
to3.x
is not as trivial as with the previous solution (kind
).Conclusion
We need to keep iterating and discussing it, so feedback is more than welcome.
The text was updated successfully, but these errors were encountered: