A channel is an addressable component, made available by the server, for the organization of messages. Producer applications send messages to channels and consumer applications consume messages from channels. (AsyncAPI definition)

Declaration of a channel

Channels are declared in services files

A channel is declared by the keyword channel followed by the name of the channel.

channel PersonTopic

This is the minimum information needed to declare a channel and use it in send and receive to start exploring graphically relationships between services.

How to send and receive messages

To go further, you can use the properties associated with channels

for instance:

channel PersonChannel{
    description"Channel for the diffusion of information about person"
messages: [Person]     brokers: [Production] }

Standard channel properties :

  • label (String)
    • short description of the message
  • description (String)
    • description of the message
  • messages (List of [string])
    • messages autorisés à utiliser ce channel
      • If no message is entered all messages are allowed
      • Filling in these messages will greatly improve the completion of the send and receive messages
  • comment (String)
    • allows you to add a comment to the message
  • urlExternalDescription (String)
    • url pointing to an external description of the message
  • path (String)
    • a relative path to an individual channel
  • parameters (String)
    • definition of path parameters
  • brokers (List of [string])
    • the brokers object names on which this channel is available.
    • If brokers is absent or empty then this channel must be available on all brokers defined in the list of brokers defined in the asyncAPI object.
      • This list of brokers is ignored when the AsyncAPI description is viewed directly from a service definition.
    • how to describe brokers

 

Example of a channel using the path and parameters   :

channel PersonChannel{
    description"channel for the diffusion of information about person"
    path:"user.{id}.info.{name}"
    parameters{
        id:Integer
        name:String
    }    
    brokers: [Production]
}