Skip to content

AMQP 0-9-1 Channel Binding v0.2.0

The AMQP channel binding defines how AsyncAPI channels map to AMQP 0-9-1 exchanges and queues. This binding allows you to specify exchange types, queue configurations, routing keys, and virtual hosts for your message broker setup.

Overview

AMQP channel bindings support two main channel types:

  • Routing Key Channels (is: routingKey): Define exchange configurations for message routing
  • Queue Channels (is: queue): Define queue configurations for message storage

Channel Types

Routing Key Channels

Routing key channels define exchange configurations for message routing. They are used when you want to publish messages to exchanges that route to multiple queues based on routing keys.

Exchange Properties

PropertyTypeRequiredDescription
typestringYesExchange type: topic, direct, fanout, default, or headers
namestringYesExchange name (max 255 characters)
durablebooleanNoWhether exchange survives broker restarts
autoDeletebooleanNoWhether exchange is deleted when last queue unbound
vhoststringNoVirtual host (defaults to /)

Exchange Types

  • Topic Exchange: Routes messages using wildcard patterns (e.g., user.*.created)
  • Direct Exchange: Routes messages using exact routing key matches
  • Fanout Exchange: Broadcasts messages to all bound queues
  • Headers Exchange: Routes messages based on message headers
  • Default Exchange: Direct routing using queue names as routing keys

Queue Channels

Queue channels define queue configurations for message storage. They are used when you want to consume messages directly from specific queues.

Queue Properties

PropertyTypeRequiredDescription
namestringYesQueue name (max 255 characters)
durablebooleanNoWhether queue survives broker restarts
exclusivebooleanNoWhether queue is used by only one connection
autoDeletebooleanNoWhether queue is deleted when last consumer unsubscribes
vhoststringNoVirtual host (defaults to /)

Examples

Topic Exchange with Routing Key

yaml
channels:
  userEvents:
    bindings:
      amqp:
        is: routingKey
        exchange:
          name: user-events
          type: topic
          durable: true
          autoDelete: false
          vhost: /
        bindingVersion: '0.2.0'

Durable Queue for Reliable Message Storage

yaml
channels:
  orderQueue:
    bindings:
      amqp:
        is: queue
        queue:
          name: order-processing-queue
          durable: true
          exclusive: false
          autoDelete: false
          vhost: /
        bindingVersion: '0.2.0'

Migration Guide

Added in v0.2.0

vhost

The vhost property was added to both exchange and queue objects in version 0.2.0. It allows you to specify the virtual host for the exchange or queue. It defaults to /.

json
{
    "vhost": { 
      "type": "string", 
      "default": "/", 
      "description": "The virtual host of the exchange. Defaults to '/'."
    } 
}