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

RequstReply: reply channel will not be displayed #855

Closed
GreenRover opened this issue Dec 6, 2023 · 1 comment
Closed

RequstReply: reply channel will not be displayed #855

GreenRover opened this issue Dec 6, 2023 · 1 comment

Comments

@GreenRover
Copy link
Contributor

Description

When an operation contains an reply channel

operations:
  requestReply:
    action: send
    channel:
      $ref: '#/channels/request'
    reply:
      channel:
        $ref: '#/channels/response'

In react ui the request channel will be displayed instead of the reply channel.
Snag_81cb7e4

Reproducer

asyncapi: 3.0.0
info:
  title: Request reply example api
  version: '1.0.0'
  description: |
    THIS IS NOT A STANDALONE API!!!
    DONT COPY PASTE!!!
    Please see this as a template that should be adopted and integrated into your api.
    Because this service is part of your application.
channels:
  request:
    address: tms/iad/lta/p/v1/prod/my/request
    description: Get a compacted view of the past.
    messages:
      request:
        $ref: '#/components/messages/request'
  response:
    address: null
    description: The response to your request
    messages:
      normalResponse:
        $ref: '#/components/messages/normalResponse'
      groupedResponse:
        $ref: '#/components/messages/groupedResponse'

operations:
  requestReply:
    action: send
    channel:
      $ref: '#/channels/request'
    reply:
      channel:
        $ref: '#/channels/response'
      messages:
        - $ref: '#/channels/response/messages/normalResponse'
        - $ref: '#/channels/response/messages/groupedResponse'
      address:
        location: '$message.header#/replyTo'
    description: >
      Request reply example operation

components:
  messageTraits:
    response:
      headers:
        type: object
        required:
          - totalReplies
          - correlationId
        properties:
          totalReplies:
            type: number
            minimum: -1
            description: |
              The total number of reply you have to expect.
              
              Edge cases:
              -  "0" There are no responses and/or there is an error. The error case indicates end of stream.
                     If `errorMessage` is not empty.  Your requests could not be processed.
                     If `errorMessage` is empty or not set, your requests dint find anything to return aka empty array.
              - "-1" The number of replies is unknown.
                     In this edge case only the last message will have a totalReplies >= 1 but the body of the EndOfStream
                     message will not be evaluated.
          correlationId:
            type: string
            description: Correlation ID set by application. To identify response to request
          errorMessage:
            type: string
            description: |
              In case of that the request was invalid. This field is given with an error message and totalReplies is set to 0
      correlationId:
        location: $message.header#/correlationId
  messages:
    request:
      name: request
      title: Your question
      headers:
        type: object
        additionalProperties: false
        required:
          - replyTo
          - correlationId
        properties:
          replyTo:
            type: string
            pattern: ^tms/iad/lta/p-\w+/v1/prod/your/reply/([\w\-]{10,})$
            maxLength: 134
            description: |
              the address where you receive the reply to.
              Use the solace ReplyTo header:
              https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/XMLMessage.html#getReplyTo--
              
              TODO: you need to adopt the pattern to match your topic from configuration.
              
              But be aware of to:
              - use a very unique system identifier. To avoid collisions and debugging purpose to identify you.
              - but not exceed the 134 char max topic length
            externalDocs:
              url: https://confluence.sbb.ch/x/Ohbleg
              description: documentation for request reply handling at tms
          groupedMessages:
            type: boolean
            description: |
              Indicates that at a multi response channel a grouped messages is acceptable.
              This flag should be `true`if:
              - You expect multiple response > 200
              - You expect small to very small response messages < 100kb
              - You dont process the header of the original update messages. Because on grouped messages all header get lost.
              
              Benefit of grouped messages:
              - The overhead will be minimized 
              - You can receive much faster
          correlationId:
            type: string
            description: Correlation ID set by application. To identify response to request
      correlationId:
        location: $message.header#/correlationId


    normalResponse:
      name: reply
      title: Reply to a request
      payload:
        type: object
        description: |
          TODO: Define here the payload Schema.
          Transfer encoded as byte array.
      headers:
        type: object
        required:
          - replyIndex
        properties:
          replyIndex:
            type: number
            minimum: 0
            description: The index of the reply message
      traits:
        - $ref: "#/components/messageTraits/response"

    groupedResponse:
      name: replyGrouped
      title: Grouped reply to a request
      description: |
        Payload contains multiple small responses in a list.
        Should be used to reduce the overhead in case a response consists of many (>200) small messages (<100kb).
      payload:
        type: array
        items:
          oneOff:
            - type: string
              enum:
                - TextMessage
                - XMLContentMessage
                - BytesMessage
                - MapMessage
                - StreamMessage
              description: The message type
            - type: object
              description: |
                TODO: Define here the payload Schema.
                Transfer encoded as byte array.
        description: |
          A list of multiple message bodies. 
          The content is a alternating list with: MessageType, body, MessageType, body, ...
          Needs to be of type solace "StreamMessage"
      headers:
        type: object
        required:
          - replyIndex
          - groupedMessages
        properties:
          replyIndex:
            type: string
            description: |
              The index range of the reply message.
            examples:
              - 0
              - 0-3
              - 4-25
          groupedMessages:
            type: boolean
            description: needs to be `true` to indicate a grouped "groupedResponse" message

      traits:
        - $ref: "#/components/messageTraits/response"
GreenRover added a commit to GreenRover/asyncapi-react that referenced this issue Dec 7, 2023
@derberg
Copy link
Member

derberg commented Dec 19, 2023

fixed with #856

@derberg derberg closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants