|
| 1 | +--- |
| 2 | +title: 'amqp' |
| 3 | +weight: 11 |
| 4 | +--- |
| 5 | + |
| 6 | +# AMQP 0-9-1 Bindings |
| 7 | + |
| 8 | +This document defines how to describe AMQP-specific information on AsyncAPI. |
| 9 | + |
| 10 | +<a name="version"></a> |
| 11 | + |
| 12 | +## Version |
| 13 | + |
| 14 | +Current version is `0.3.0`. |
| 15 | + |
| 16 | + |
| 17 | +<a name="server"></a> |
| 18 | + |
| 19 | +## Server Binding Object |
| 20 | + |
| 21 | +This object MUST NOT contain any properties. Its name is reserved for future use. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +<a name="channel"></a> |
| 27 | + |
| 28 | +## Channel Binding Object |
| 29 | + |
| 30 | +This object contains information about the channel representation in AMQP. |
| 31 | + |
| 32 | +##### Fixed Fields |
| 33 | + |
| 34 | +Field Name | Type | Description |
| 35 | +---|:---:|--- |
| 36 | +<a name="channelBindingObjectIs"></a>`is` | string | Defines what type of channel is it. Can be either `queue` or `routingKey` (default). |
| 37 | +<a name="channelBindingObjectExchange"></a>`exchange` | Map[string, any] | When `is`=`routingKey`, this object defines the exchange properties. |
| 38 | +<a name="channelBindingObjectExchangeName"></a>`exchange.name` | string | The name of the exchange. It MUST NOT exceed 255 characters long. |
| 39 | +<a name="channelBindingObjectExchangeType"></a>`exchange.type` | string | The type of the exchange. Can be either `topic`, `direct`, `fanout`, `default` or `headers`. |
| 40 | +<a name="channelBindingObjectExchangeDurable"></a>`exchange.durable` | boolean | Whether the exchange should survive broker restarts or not. |
| 41 | +<a name="channelBindingObjectExchangeAutoDelete"></a>`exchange.autoDelete` | boolean | Whether the exchange should be deleted when the last queue is unbound from it. |
| 42 | +<a name="channelBindingObjectExchangeVHost"></a>`exchange.vhost` | string | The virtual host of the exchange. Defaults to `/`. |
| 43 | +<a name="channelBindingObjectQueue"></a>`queue` | Map[string, any] | When `is`=`queue`, this object defines the queue properties. |
| 44 | +<a name="channelBindingObjectQueueName"></a>`queue.name` | string | The name of the queue. It MUST NOT exceed 255 characters long. |
| 45 | +<a name="channelBindingObjectQueueDurable"></a>`queue.durable` | boolean | Whether the queue should survive broker restarts or not. |
| 46 | +<a name="channelBindingObjectQueueExclusive"></a>`queue.exclusive` | boolean | Whether the queue should be used only by one connection or not. |
| 47 | +<a name="channelBindingObjectAutoDelete"></a>`queue.autoDelete` | boolean | Whether the queue should be deleted when the last consumer unsubscribes. |
| 48 | +<a name="channelBindingObjectQueueVHost"></a>`queue.vhost` | string | The virtual host of the queue. Defaults to `/`. |
| 49 | +<a name="channelBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. |
| 50 | + |
| 51 | +This object MUST contain only the properties defined above. |
| 52 | + |
| 53 | +##### Example |
| 54 | + |
| 55 | +```yaml |
| 56 | +channels: |
| 57 | + userSignup: |
| 58 | + address: 'user/signup' |
| 59 | + bindings: |
| 60 | + amqp: |
| 61 | + is: routingKey |
| 62 | + exchange: |
| 63 | + name: myExchange |
| 64 | + type: topic |
| 65 | + durable: true |
| 66 | + autoDelete: false |
| 67 | + vhost: / |
| 68 | + bindingVersion: 0.3.0 |
| 69 | +``` |
| 70 | +
|
| 71 | +```yaml |
| 72 | +channels: |
| 73 | + userSignup: |
| 74 | + address: 'user/signup' |
| 75 | + bindings: |
| 76 | + amqp: |
| 77 | + is: queue |
| 78 | + queue: |
| 79 | + name: my-queue-name |
| 80 | + durable: true |
| 81 | + exclusive: true |
| 82 | + autoDelete: false |
| 83 | + vhost: / |
| 84 | + bindingVersion: 0.3.0 |
| 85 | +``` |
| 86 | +
|
| 87 | +<a name="operation"></a> |
| 88 | +
|
| 89 | +## Operation Binding Object |
| 90 | +
|
| 91 | +This object contains information about the operation representation in AMQP. |
| 92 | +
|
| 93 | +##### Fixed Fields |
| 94 | +
|
| 95 | +Field Name | Type | Applies To Action | Description |
| 96 | +---|:---:|:---:|--- |
| 97 | +<a name="operationBindingObjectExpiration"></a>`expiration` | integer | `receive`, `send` | TTL (Time-To-Live) for the message. It MUST be greater than or equal to zero. |
| 98 | +<a name="operationBindingObjectUserId"></a>`userId` | string | `receive`, `send` | Identifies the user who has sent the message. |
| 99 | +<a name="operationBindingObjectCC"></a>`cc` | [string] | `receive`, `send` | The routing keys the message should be routed to at the time of publishing. |
| 100 | +<a name="operationBindingObjectPriority"></a>`priority` | integer | `receive`, `send` | A priority for the message. |
| 101 | +<a name="operationBindingObjectDeliveryMode"></a>`deliveryMode` | integer | `receive`, `send` | Delivery mode of the message. Its value MUST be either 1 (transient) or 2 (persistent). |
| 102 | +<a name="operationBindingObjectMandatory"></a>`mandatory` | boolean | `receive` | Whether the message is mandatory or not. |
| 103 | +<a name="operationBindingObjectBCC"></a>`bcc` | [string] | `receive` | Like [cc](#operationBindingObjectCC) but consumers will not receive this information. |
| 104 | +<a name="operationBindingObjectTimestamp"></a>`timestamp` | boolean | `receive`, `send` | Whether the message should include a timestamp or not. |
| 105 | +<a name="operationBindingObjectAck"></a>`ack` | boolean | Subscribe | Whether the consumer should ack the message or not. |
| 106 | +<a name="operationBindingObjectBindingVersion"></a>`bindingVersion` | string | `receive`, `send` | The version of this binding. If omitted, "latest" MUST be assumed. |
| 107 | + |
| 108 | +This object MUST contain only the properties defined above. |
| 109 | + |
| 110 | +##### Example |
| 111 | + |
| 112 | +```yaml |
| 113 | +operations: |
| 114 | + userSignup: |
| 115 | + channel: |
| 116 | + $ref: '#/channels/userSignup' |
| 117 | + bindings: |
| 118 | + amqp: |
| 119 | + expiration: 100000 |
| 120 | + userId: guest |
| 121 | + cc: ['user.logs'] |
| 122 | + priority: 10 |
| 123 | + deliveryMode: 2 |
| 124 | + mandatory: false |
| 125 | + bcc: ['external.audit'] |
| 126 | + timestamp: true |
| 127 | + ack: false |
| 128 | + bindingVersion: 0.3.0 |
| 129 | +``` |
| 130 | + |
| 131 | + |
| 132 | +<a name="message"></a> |
| 133 | + |
| 134 | +## Message Binding Object |
| 135 | + |
| 136 | +This object contains information about the message representation in AMQP. |
| 137 | + |
| 138 | +##### Fixed Fields |
| 139 | + |
| 140 | +Field Name | Type | Description |
| 141 | +---|:---:|--- |
| 142 | +<a name="messageBindingObjectContentEncoding"></a>`contentEncoding` | string | A MIME encoding for the message content. |
| 143 | +<a name="messageBindingObjectMessageType"></a>`messageType` | string | Application-specific message type. |
| 144 | +<a name="messageBindingObjectBindingVersion"></a>`bindingVersion` | string | The version of this binding. If omitted, "latest" MUST be assumed. |
| 145 | + |
| 146 | +This object MUST contain only the properties defined above. |
| 147 | + |
| 148 | +```yaml |
| 149 | +channels: |
| 150 | + userSignup: |
| 151 | + address: 'user/signup' |
| 152 | + messages: |
| 153 | + userSignupMessage: |
| 154 | + bindings: |
| 155 | + amqp: |
| 156 | + contentEncoding: gzip |
| 157 | + messageType: 'user.signup' |
| 158 | + bindingVersion: 0.3.0 |
| 159 | +``` |
0 commit comments