Skip to content
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

Support callback message descriptions #55

Closed
ghost opened this issue Jan 16, 2018 · 6 comments
Closed

Support callback message descriptions #55

ghost opened this issue Jan 16, 2018 · 6 comments
Labels
keep-open Prevents stale bot from closing this issue or PR

Comments

@ghost
Copy link

ghost commented Jan 16, 2018

Right now, AsyncAPI does not specify how callback messages should be described.

Some ad-hoc approaches can be used. For instance:

  • a topic.publish request's callback message can be described on topic.subscribe (even though it will probably not be conveyed through 'topic')
  • a topic.subscribe operation's callback message can be described on topic.publish (even though it will probably not be conveyed through 'topic')
  • a separate callback topic can be described (e.g., using Topic Templating as required), together with the message

Hence, for convenience and clarity reasons, a structural callback-specification approach similar to the one proposed in OpenAPIv3 (cfr. spec + example) might be interesting for AsyncAPI as well?

It could look like this:

topics:
  UPDATEARTICLE:
    publish:
      headers:
        type: object
        properties:
          reply-to:
            type: string
            description: Callback Destination to be messaged when the Article was updated
          correlation-id:
            $ref : '#/components/schemas/Correlation-id'
      payload:
        type: object
        properties:
          ...
      callbacks:
        reply:
          '{$request.header.reply-to}':
            publish:
              summary: Reply sent through callback
              headers:
                type: object
                properties:
                  correlation-id:
                    $ref : '#/components/schemas/Correlation-id'          
              payload:
                  type: object
                  properties:
                    success:
                      type: boolean
                    statusMsg:
                      type: string 

Thanks in advance for considering this feature request!

@fmvilas
Copy link
Member

fmvilas commented Jan 16, 2018

I'll dig a bit more on this feature because it's really interesting. Thanks!

@marchon
Copy link

marchon commented Mar 7, 2018

The RFC for HTTP [RFC 7231] includes a specification for "Content Negotiation" between the request agent and the response agent. Encapsulating a method of communication of preferred request and response metadata could solve a lot of not yet anticipated future problems.

5.3. Content Negotiation

The following request header fields are sent by a user agent to
engage in proactive negotiation of the response content, as defined
in Section 3.4.1. The preferences sent in these fields apply to any
content in the response, including representations of the target
resource, representations of error or processing status, and
potentially even the miscellaneous text strings that might appear
within the protocol.

+-------------------+---------------+
| Header Field Name | Defined in... |
+-------------------+---------------+
| Accept | Section 5.3.2 |
| Accept-Charset | Section 5.3.3 |
| Accept-Encoding | Section 5.3.4 |
| Accept-Language | Section 5.3.5 |
+-------------------+---------------+

5.3.2. Accept

The "Accept" header field can be used by user agents to specify response media types that are acceptable.

3.1.1.5. Content-Type

The "Content-Type" header field indicates the media type of the associated representation

So: Accept indicates what kind of response from the server the client can accept. Content-type always is about the content of the current request or response.

So if your request has no payload, you don't use a content-type request header.

@fmvilas fmvilas modified the milestone: Backlog Feb 3, 2019
@stale
Copy link

stale bot commented Oct 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Oct 29, 2019
@fmvilas fmvilas removed the stale label Oct 30, 2019
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Mar 12, 2020
@fmvilas fmvilas added this to the AsyncAPI specification 2.1.0 milestone Mar 13, 2020
@derberg derberg reopened this Apr 13, 2020
@derberg derberg removed the stale label Apr 13, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label Jun 13, 2020
@fmvilas fmvilas added keep-open Prevents stale bot from closing this issue or PR and removed stale labels Jun 14, 2020
@fmvilas fmvilas removed this from the Next specification version milestone May 12, 2021
@smoya
Copy link
Member

smoya commented Feb 5, 2024

We can close this as Request/Reply pattern is now a thing in v3.

@smoya smoya closed this as completed Feb 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keep-open Prevents stale bot from closing this issue or PR
Projects
None yet
Development

No branches or pull requests

4 participants