Skip to content

Update tutorials/documentation to reflect publish/subscribe semantics #40

@karloskalcium

Description

@karloskalcium

There are several areas in the tutorials/documentation where publish/subscribe semantics are in need of correction or could be updated to be more clear:

  1. The Hello World https://asyncapi.io/docs/getting-started/hello-world/

    I would argue that the Hello World example, if we're starting with that, should initially be an example of an event publisher vs an event consumer. The most common 'hello-world' application prints out "Hello World" to the screen, so the first example should do the same IMO - e.g. publish a 'hello world' message to a queue.

  2. This line is a bit unclear:
    You can read the highlighted lines as “this is the payload of the message your app can publish to the «hello» channel”.

    When we say "your app", at this point we are not describing the 'hello-world' app, but rather a separate publisher app. that makes this example a bit confusing. I would suggest that reworking the example to focus on a publisher vs consumer would make this more clear.

  3. On this page, the code switches semantics to using a 'subscribe' vs 'publish' option - we should make this the same as the first part of the tutorial

  4. On this page, it defines a publisher that uses 'publish' actions - again we should make these all the same. IMO, that should be the examples are always about publishers, and they always use 'subscribe' actions.

  5. In the streetlights tutorial, it says the following:
    We’ll publish messages to the broker and that’s it. Our service don’t know who will receive them.
    However, this is a bit strange, because later on the page you are creating the service that will receive these events - and you aren't actually ever creating the services that send the events. This confused me for a while...

    Also the API is defined as follows:The Smartylighting Streetlights API allows you to remotely manage the city lights.

    However, as defined, this api is not really able to 'manage' the lights, it's only able to monitor them.

  6. I found this blog post really useful:
    However, it uses the old semantics - defining a userService that publishes (and uses the publish action). Now that 2.0 is out, and a decision has made to switch semantics, the old blog post should be IMO reworded with the right examples.

  7. We could even extend the hello-world example to have both a publisher and a consumer, sharing a common message definition. This way we can explain the idea of reuse of message contents in the tutorial itself.

  8. Finally the spec itself should have a clearly elaborated section describing the different between publish and subscribe in formal terms. Currently it just has A definition of the SUBSCRIBE operation.. This should be enhanced with clear description of when an API should define a SUBSCRIBE operation (namely, to tell "clients" of the API that they can subscribe to that channel in order to get messages sent by this publisher)

I made an initial PR, but I realize that some parts of it are incorrect now. So let's discuss here in this issue what needs to be done, then I will update the PR accordingly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions