AMQP 0-9-1 Channel Binding v0.3.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
Property | Type | Required | Description |
---|---|---|---|
type | string | Yes | Exchange type: topic , direct , fanout , default , or headers |
name | string | Yes | Exchange name (max 255 characters) |
durable | boolean | No | Whether exchange survives broker restarts |
autoDelete | boolean | No | Whether exchange is deleted when last queue unbound |
vhost | string | No | Virtual 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
Property | Type | Required | Description |
---|---|---|---|
name | string | Yes | Queue name (max 255 characters) |
durable | boolean | No | Whether queue survives broker restarts |
exclusive | boolean | No | Whether queue is used by only one connection |
autoDelete | boolean | No | Whether queue is deleted when last consumer unsubscribes |
vhost | string | No | Virtual 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.3.0'
Direct Exchange for Point-to-Point Communication
yaml
channels:
orderProcessing:
bindings:
amqp:
is: routingKey
exchange:
name: order-exchange
type: direct
durable: true
autoDelete: false
vhost: /
bindingVersion: '0.3.0'
Fanout Exchange for Broadcasting
yaml
channels:
notifications:
bindings:
amqp:
is: routingKey
exchange:
name: notification-broadcast
type: fanout
durable: true
autoDelete: false
vhost: /
bindingVersion: '0.3.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.3.0'
Exclusive Queue for Single Consumer
yaml
channels:
auditQueue:
bindings:
amqp:
is: queue
queue:
name: audit-queue
durable: true
exclusive: true
autoDelete: true
vhost: /
bindingVersion: '0.3.0'
Multi-Tenant Configuration with Virtual Hosts
yaml
channels:
tenantEvents:
bindings:
amqp:
is: routingKey
exchange:
name: tenant-events
type: topic
durable: true
autoDelete: false
vhost: tenant-{tenantId}
bindingVersion: '0.3.0'
Use Cases
Event-Driven Architecture
yaml
channels:
domainEvents:
bindings:
amqp:
is: routingKey
exchange:
name: domain-events
type: topic
durable: true
autoDelete: false
vhost: /
bindingVersion: '0.3.0'
Microservices Communication
yaml
channels:
serviceCommunication:
bindings:
amqp:
is: routingKey
exchange:
name: service-bus
type: direct
durable: true
autoDelete: false
vhost: /
bindingVersion: '0.3.0'
Real-Time Notifications
yaml
channels:
realTimeNotifications:
bindings:
amqp:
is: routingKey
exchange:
name: real-time-notifications
type: fanout
durable: true
autoDelete: false
vhost: /
bindingVersion: '0.3.0'
Work Queue Pattern
yaml
channels:
workQueue:
bindings:
amqp:
is: queue
queue:
name: work-queue
durable: true
exclusive: false
autoDelete: false
vhost: /
bindingVersion: '0.3.0'
Versioning
This binding is for version 0.3.0
of the AMQP binding specification.