@amqp-contract/contract 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/index.md CHANGED
@@ -12,7 +12,7 @@
12
12
  type AnySchema = StandardSchemaV1;
13
13
  ```
14
14
 
15
- Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L12)
15
+ Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L12)
16
16
 
17
17
  Any schema that conforms to Standard Schema v1.
18
18
 
@@ -32,7 +32,7 @@ https://github.com/standard-schema/standard-schema
32
32
  type BaseExchangeDefinition<TName> = object;
33
33
  ```
34
34
 
35
- Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L376)
35
+ Defined in: [types.ts:394](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L394)
36
36
 
37
37
  Base definition of an AMQP exchange.
38
38
 
@@ -49,11 +49,11 @@ type and routing rules. This type contains properties common to all exchange typ
49
49
 
50
50
  | Property | Type | Description | Defined in |
51
51
  | ------ | ------ | ------ | ------ |
52
- | <a id="arguments"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:405](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L405) |
53
- | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:392](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L392) |
54
- | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:386](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L386) |
55
- | <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. **Default** `false` | [types.ts:399](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L399) |
56
- | <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L380) |
52
+ | <a id="arguments"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. Common arguments include alternate-exchange for handling unroutable messages. | [types.ts:421](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L421) |
53
+ | <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. | [types.ts:409](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L409) |
54
+ | <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `true` | [types.ts:404](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L404) |
55
+ | <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. | [types.ts:415](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L415) |
56
+ | <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:398](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L398) |
57
57
 
58
58
  ***
59
59
 
@@ -65,7 +65,7 @@ type BindingDefinition =
65
65
  | ExchangeBindingDefinition;
66
66
  ```
67
67
 
68
- Defined in: [types.ts:833](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L833)
68
+ Defined in: [types.ts:891](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L891)
69
69
 
70
70
  Union type of all binding definitions.
71
71
 
@@ -81,7 +81,7 @@ A binding can be either:
81
81
  type BindingPattern<S> = S extends "" ? never : S;
82
82
  ```
83
83
 
84
- Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/routing-types.ts#L52)
84
+ Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/routing-types.ts#L52)
85
85
 
86
86
  Type-safe binding pattern that validates basic format and wildcards.
87
87
 
@@ -116,7 +116,7 @@ type Invalid = BindingPattern<"">; // never (empty string)
116
116
  type BridgedPublisherConfig<TMessage, TBridgeExchange, TTargetExchange> = object;
117
117
  ```
118
118
 
119
- Defined in: [builder/command.ts:66](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L66)
119
+ Defined in: [builder/command.ts:61](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L61)
120
120
 
121
121
  Configuration for a bridged command publisher.
122
122
 
@@ -135,11 +135,11 @@ messages to the target exchange (remote domain) via an exchange-to-exchange bind
135
135
 
136
136
  | Property | Type | Description | Defined in |
137
137
  | ------ | ------ | ------ | ------ |
138
- | <a id="__brand"></a> `__brand` | `"BridgedPublisherConfig"` | Discriminator to identify this as a bridged publisher config | [builder/command.ts:72](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L72) |
139
- | <a id="bridgeexchange"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange | [builder/command.ts:78](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L78) |
140
- | <a id="exchangebinding"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | The exchange-to-exchange binding (bridge → target) | [builder/command.ts:76](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L76) |
141
- | <a id="publisher"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt; | The publisher definition (publishes to bridge exchange) | [builder/command.ts:74](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L74) |
142
- | <a id="targetexchange"></a> `targetExchange` | `TTargetExchange` | The target (remote domain) exchange | [builder/command.ts:80](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L80) |
138
+ | <a id="__brand"></a> `__brand` | `"BridgedPublisherConfig"` | Discriminator to identify this as a bridged publisher config | [builder/command.ts:67](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L67) |
139
+ | <a id="bridgeexchange"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange | [builder/command.ts:73](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L73) |
140
+ | <a id="exchangebinding"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | The exchange-to-exchange binding (bridge → target) | [builder/command.ts:71](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L71) |
141
+ | <a id="publisher"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt; | The publisher definition (publishes to bridge exchange) | [builder/command.ts:69](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L69) |
142
+ | <a id="targetexchange"></a> `targetExchange` | `TTargetExchange` | The target (remote domain) exchange | [builder/command.ts:75](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L75) |
143
143
 
144
144
  ***
145
145
 
@@ -149,7 +149,7 @@ messages to the target exchange (remote domain) via an exchange-to-exchange bind
149
149
  type BridgedPublisherConfigBase = object;
150
150
  ```
151
151
 
152
- Defined in: [types.ts:968](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L968)
152
+ Defined in: [types.ts:1024](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1024)
153
153
 
154
154
  Base type for bridged publisher configuration.
155
155
 
@@ -164,11 +164,11 @@ defineCommandPublisher with bridgeExchange option
164
164
 
165
165
  | Property | Type | Defined in |
166
166
  | ------ | ------ | ------ |
167
- | <a id="__brand-1"></a> `__brand` | `"BridgedPublisherConfig"` | [types.ts:969](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L969) |
168
- | <a id="bridgeexchange-1"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:972](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L972) |
169
- | <a id="exchangebinding-1"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | [types.ts:971](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L971) |
170
- | <a id="publisher-1"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition) | [types.ts:970](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L970) |
171
- | <a id="targetexchange-1"></a> `targetExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:973](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L973) |
167
+ | <a id="__brand-1"></a> `__brand` | `"BridgedPublisherConfig"` | [types.ts:1025](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1025) |
168
+ | <a id="bridgeexchange-1"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1028](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1028) |
169
+ | <a id="exchangebinding-1"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | [types.ts:1027](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1027) |
170
+ | <a id="publisher-1"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition) | [types.ts:1026](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1026) |
171
+ | <a id="targetexchange-1"></a> `targetExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1029](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1029) |
172
172
 
173
173
  ***
174
174
 
@@ -178,21 +178,22 @@ defineCommandPublisher with bridgeExchange option
178
178
  type ClassicQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
179
179
  ```
180
180
 
181
- Defined in: [types.ts:595](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L595)
181
+ Defined in: [types.ts:608](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L608)
182
182
 
183
183
  Definition of a classic queue.
184
184
 
185
185
  Classic queues are the traditional RabbitMQ queue type. Use them when you need
186
- specific features not supported by quorum queues (e.g., exclusive queues, priority queues).
186
+ specific features not supported by quorum queues (e.g., exclusive queues, auto-deleting queues, priority queues).
187
187
 
188
188
  #### Type Declaration
189
189
 
190
190
  | Name | Type | Description | Defined in |
191
191
  | ------ | ------ | ------ | ------ |
192
- | `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:605](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L605) |
193
- | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:612](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L612) |
194
- | `retry` | `ResolvedTtlBackoffRetryOptions` | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode (default). When the queue is created, defaults are applied. | [types.ts:620](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L620) |
195
- | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:599](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L599) |
192
+ | `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:628](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L628) |
193
+ | `durable` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. | [types.ts:617](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L617) |
194
+ | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. | [types.ts:623](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L623) |
195
+ | `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:634](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L634) |
196
+ | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:612](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L612) |
196
197
 
197
198
  #### Type Parameters
198
199
 
@@ -208,12 +209,13 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
208
209
  type ClassicQueueOptions = BaseQueueOptions & object;
209
210
  ```
210
211
 
211
- Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L318)
212
+ Defined in: [types.ts:342](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L342)
212
213
 
213
214
  Options for creating a classic queue.
214
215
 
215
216
  Classic queues support all traditional RabbitMQ features including:
216
- - `exclusive: true` - For connection-scoped queues
217
+ - `exclusive` - For connection-scoped queues
218
+ - `autoDelete` - For auto-deleting queues when consumers disconnect
217
219
  - `maxPriority` - For priority queues
218
220
  - `durable: false` - For non-durable queues
219
221
 
@@ -221,17 +223,17 @@ Classic queues support all traditional RabbitMQ features including:
221
223
 
222
224
  | Name | Type | Description | Defined in |
223
225
  | ------ | ------ | ------ | ------ |
224
- | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:329](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L329) |
225
- | `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. Only supported with classic queues. | [types.ts:336](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L336) |
226
- | `retry?` | [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode, which uses wait queues with exponential backoff. For quorum-native retry, use quorum queues instead. **Example** `const orderQueue = defineQueue('order-processing', { type: 'classic', durable: true, deadLetter: { exchange: dlx }, retry: { maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, });` | [types.ts:358](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L358) |
227
- | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L322) |
226
+ | `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. | [types.ts:363](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L363) |
227
+ | `durable?` | `boolean` | If true, the queue survives broker restarts. Durable queues are persisted to disk. **Default** `true` | [types.ts:352](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L352) |
228
+ | `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. | [types.ts:358](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L358) |
229
+ | `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. | [types.ts:369](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L369) |
230
+ | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:346](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L346) |
228
231
 
229
232
  #### Example
230
233
 
231
234
  ```typescript
232
235
  const priorityQueue = defineQueue('tasks', {
233
236
  type: 'classic',
234
- durable: true,
235
237
  maxPriority: 10,
236
238
  });
237
239
  ```
@@ -241,10 +243,10 @@ const priorityQueue = defineQueue('tasks', {
241
243
  ### CommandConsumerConfig
242
244
 
243
245
  ```ts
244
- type CommandConsumerConfig<TMessage, TExchange, TRoutingKey, TQueue, TDlxExchange> = object;
246
+ type CommandConsumerConfig<TMessage, TExchange, TRoutingKey, TQueue> = object;
245
247
  ```
246
248
 
247
- Defined in: [builder/command.ts:31](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L31)
249
+ Defined in: [builder/command.ts:29](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L29)
248
250
 
249
251
  Configuration for a command consumer.
250
252
 
@@ -257,22 +259,20 @@ The consumer "owns" the queue, and publishers send commands to it.
257
259
  | ------ | ------ | ------ |
258
260
  | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
259
261
  | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | - | The exchange definition |
260
- | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout) |
261
- | `TQueue` *extends* [`QueueDefinition`](#queuedefinition) | [`QueueDefinition`](#queuedefinition) | - |
262
- | `TDlxExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
262
+ | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout and headers exchanges) |
263
+ | `TQueue` *extends* [`QueueEntry`](#queueentry) | [`QueueEntry`](#queueentry) | - |
263
264
 
264
265
  #### Properties
265
266
 
266
267
  | Property | Type | Description | Defined in |
267
268
  | ------ | ------ | ------ | ------ |
268
- | <a id="__brand-2"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:39](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L39) |
269
- | <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:43](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L43) |
270
- | <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing commands | [builder/command.ts:41](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L41) |
271
- | <a id="deadletterexchange"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/command.ts:49](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L49) |
272
- | <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:45](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L45) |
273
- | <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:51](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L51) |
274
- | <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:47](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L47) |
275
- | <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:53](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L53) |
269
+ | <a id="__brand-2"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:36](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L36) |
270
+ | <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:40](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L40) |
271
+ | <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing commands | [builder/command.ts:38](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L38) |
272
+ | <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:42](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L42) |
273
+ | <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:46](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L46) |
274
+ | <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:44](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L44) |
275
+ | <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:48](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L48) |
276
276
 
277
277
  ***
278
278
 
@@ -282,7 +282,7 @@ The consumer "owns" the queue, and publishers send commands to it.
282
282
  type CommandConsumerConfigBase = object;
283
283
  ```
284
284
 
285
- Defined in: [types.ts:930](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L930)
285
+ Defined in: [types.ts:988](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L988)
286
286
 
287
287
  Base type for command consumer configuration.
288
288
 
@@ -297,14 +297,13 @@ defineCommandConsumer for creating command consumers
297
297
 
298
298
  | Property | Type | Defined in |
299
299
  | ------ | ------ | ------ |
300
- | <a id="__brand-3"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:931](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L931) |
301
- | <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:933](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L933) |
302
- | <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L932) |
303
- | <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:936](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L936) |
304
- | <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:934](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L934) |
305
- | <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:937](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L937) |
306
- | <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:935](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L935) |
307
- | <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:938](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L938) |
300
+ | <a id="__brand-3"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:989](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L989) |
301
+ | <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:991](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L991) |
302
+ | <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:990](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L990) |
303
+ | <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:992](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L992) |
304
+ | <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:994](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L994) |
305
+ | <a id="queue-1"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:993](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L993) |
306
+ | <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:995](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L995) |
308
307
 
309
308
  ***
310
309
 
@@ -314,7 +313,7 @@ defineCommandConsumer for creating command consumers
314
313
  type CompressionAlgorithm = "gzip" | "deflate";
315
314
  ```
316
315
 
317
- Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L134)
316
+ Defined in: [types.ts:199](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L199)
318
317
 
319
318
  Supported compression algorithms for message payloads.
320
319
 
@@ -352,7 +351,7 @@ await client.publish("orderCreated", payload, {
352
351
  type ConsumerDefinition<TMessage> = object;
353
352
  ```
354
353
 
355
- Defined in: [types.ts:894](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L894)
354
+ Defined in: [types.ts:952](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L952)
356
355
 
357
356
  Definition of a message consumer.
358
357
 
@@ -380,8 +379,8 @@ const consumer: ConsumerDefinition = {
380
379
 
381
380
  | Property | Type | Description | Defined in |
382
381
  | ------ | ------ | ------ | ------ |
383
- | <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:899](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L899) |
384
- | <a id="queue-2"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:896](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L896) |
382
+ | <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:957](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L957) |
383
+ | <a id="queue-2"></a> `queue` | [`QueueEntry`](#queueentry) | The queue to consume messages from | [types.ts:954](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L954) |
385
384
 
386
385
  ***
387
386
 
@@ -394,7 +393,7 @@ type ConsumerEntry =
394
393
  | CommandConsumerConfigBase;
395
394
  ```
396
395
 
397
- Defined in: [types.ts:1066](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1066)
396
+ Defined in: [types.ts:1123](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1123)
398
397
 
399
398
  Consumer entry that can be passed to defineContract's consumers section.
400
399
 
@@ -411,7 +410,7 @@ Can be either:
411
410
  type ContractDefinition = object;
412
411
  ```
413
412
 
414
- Defined in: [types.ts:1009](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1009)
413
+ Defined in: [types.ts:1065](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1065)
415
414
 
416
415
  Complete AMQP contract definition (output type).
417
416
 
@@ -450,11 +449,11 @@ const contract: ContractDefinition = {
450
449
 
451
450
  | Property | Type | Description | Defined in |
452
451
  | ------ | ------ | ------ | ------ |
453
- | <a id="bindings"></a> `bindings?` | `Record`&lt;`string`, [`BindingDefinition`](#bindingdefinition)&gt; | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:1029](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1029) |
454
- | <a id="consumers"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerDefinition`](#consumerdefinition)&gt; | Named consumer definitions. Each key requires a corresponding handler in the TypedAmqpWorker. The handler will be fully typed based on the message schema. | [types.ts:1043](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1043) |
455
- | <a id="exchanges"></a> `exchanges?` | `Record`&lt;`string`, [`ExchangeDefinition`](#exchangedefinition)&gt; | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:1014](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1014) |
456
- | <a id="publishers"></a> `publishers?` | `Record`&lt;`string`, [`PublisherDefinition`](#publisherdefinition)&gt; | Named publisher definitions. Each key becomes a method on the TypedAmqpClient for publishing messages. The method will be fully typed based on the message schema. | [types.ts:1036](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1036) |
457
- | <a id="queues"></a> `queues?` | `Record`&lt;`string`, [`QueueEntry`](#queueentry)&gt; | Named queue definitions. Each key becomes available as a named resource in the contract. When a queue has TTL-backoff retry configured, pass the `QueueWithTtlBackoffInfrastructure` object returned by `defineQueue`. The wait queue and bindings will be automatically added. | [types.ts:1023](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1023) |
452
+ | <a id="bindings"></a> `bindings?` | `Record`&lt;`string`, [`BindingDefinition`](#bindingdefinition)&gt; | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:1085](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1085) |
453
+ | <a id="consumers"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerDefinition`](#consumerdefinition)&gt; | Named consumer definitions. Each key requires a corresponding handler in the TypedAmqpWorker. The handler will be fully typed based on the message schema. | [types.ts:1099](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1099) |
454
+ | <a id="exchanges"></a> `exchanges?` | `Record`&lt;`string`, [`ExchangeDefinition`](#exchangedefinition)&gt; | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:1070](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1070) |
455
+ | <a id="publishers"></a> `publishers?` | `Record`&lt;`string`, [`PublisherDefinition`](#publisherdefinition)&gt; | Named publisher definitions. Each key becomes a method on the TypedAmqpClient for publishing messages. The method will be fully typed based on the message schema. | [types.ts:1092](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1092) |
456
+ | <a id="queues"></a> `queues?` | `Record`&lt;`string`, [`QueueEntry`](#queueentry)&gt; | Named queue definitions. Each key becomes available as a named resource in the contract. When a queue has TTL-backoff retry configured, pass the `QueueWithTtlBackoffInfrastructure` object returned by `defineQueue`. The wait queue, exchanges, and bindings will be automatically added. | [types.ts:1079](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1079) |
458
457
 
459
458
  ***
460
459
 
@@ -464,7 +463,7 @@ const contract: ContractDefinition = {
464
463
  type ContractDefinitionInput = object;
465
464
  ```
466
465
 
467
- Defined in: [types.ts:1095](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1095)
466
+ Defined in: [types.ts:1152](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1152)
468
467
 
469
468
  Contract definition input type with automatic extraction of event/command patterns.
470
469
 
@@ -496,8 +495,8 @@ defineContract - Processes this input and returns a ContractDefinition
496
495
 
497
496
  | Property | Type | Description | Defined in |
498
497
  | ------ | ------ | ------ | ------ |
499
- | <a id="consumers-1"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:1113](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1113) |
500
- | <a id="publishers-1"></a> `publishers?` | `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1103](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1103) |
498
+ | <a id="consumers-1"></a> `consumers?` | `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; | Named consumer definitions. Can accept: - ConsumerDefinition from defineConsumer - EventConsumerResult from defineEventConsumer (binding auto-extracted) - CommandConsumerConfig from defineCommandConsumer (binding auto-extracted) | [types.ts:1170](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1170) |
499
+ | <a id="publishers-1"></a> `publishers?` | `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1160](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1160) |
501
500
 
502
501
  ***
503
502
 
@@ -507,7 +506,7 @@ defineContract - Processes this input and returns a ContractDefinition
507
506
  type ContractOutput<TContract> = object;
508
507
  ```
509
508
 
510
- Defined in: [types.ts:1422](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1422)
509
+ Defined in: [types.ts:1469](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1469)
511
510
 
512
511
  Contract output type with all resources extracted and properly typed.
513
512
 
@@ -528,11 +527,11 @@ This type represents the fully expanded contract with:
528
527
 
529
528
  | Property | Type | Defined in |
530
529
  | ------ | ------ | ------ |
531
- | <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractBindingsFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractExchangeBindingsFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractExchangeBindingsFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1441](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1441) |
532
- | <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractConsumerDefinitions`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1453](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1453) |
533
- | <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractExchangesFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractDeadLetterExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractBridgeExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractTargetExchangesFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1423](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1423) |
534
- | <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractPublisherDefinitions`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1450](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1450) |
535
- | <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractQueuesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1438](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1438) |
530
+ | <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractBindingsFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractExchangeBindingsFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractExchangeBindingsFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1488](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1488) |
531
+ | <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractConsumerDefinitions`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1500](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1500) |
532
+ | <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractExchangesFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractDeadLetterExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractBridgeExchangesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` & `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractTargetExchangesFromPublishers`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1470](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1470) |
533
+ | <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; ? `ExtractPublisherDefinitions`&lt;`TContract`\[`"publishers"`\]&gt; : `object` | [types.ts:1497](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1497) |
534
+ | <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`&lt;`string`, [`ConsumerEntry`](#consumerentry)&gt; ? `ExtractQueuesFromConsumers`&lt;`TContract`\[`"consumers"`\]&gt; : `object` | [types.ts:1485](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1485) |
536
535
 
537
536
  ***
538
537
 
@@ -542,7 +541,7 @@ This type represents the fully expanded contract with:
542
541
  type DeadLetterConfig = object;
543
542
  ```
544
543
 
545
- Defined in: [types.ts:483](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L483)
544
+ Defined in: [types.ts:518](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L518)
546
545
 
547
546
  Configuration for dead letter exchange (DLX) on a queue.
548
547
 
@@ -554,8 +553,8 @@ or storage.
554
553
 
555
554
  | Property | Type | Description | Defined in |
556
555
  | ------ | ------ | ------ | ------ |
557
- | <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:488](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L488) |
558
- | <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:494](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L494) |
556
+ | <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:523](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L523) |
557
+ | <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:529](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L529) |
559
558
 
560
559
  ***
561
560
 
@@ -567,67 +566,13 @@ type DefineQueueOptions =
567
566
  | ClassicQueueOptions;
568
567
  ```
569
568
 
570
- Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L368)
569
+ Defined in: [types.ts:379](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L379)
571
570
 
572
571
  Options for defining a queue. Uses a discriminated union based on the `type` property
573
572
  to enforce quorum queue constraints at compile time.
574
573
 
575
- - Quorum queues (default): Do not support `exclusive` or `maxPriority`
576
- - Classic queues: Support all options including `exclusive` and `maxPriority`
577
-
578
- ***
579
-
580
- ### DefineQuorumQueueOptions
581
-
582
- ```ts
583
- type DefineQuorumQueueOptions = object;
584
- ```
585
-
586
- Defined in: [builder/queue.ts:399](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L399)
587
-
588
- Options for creating a quorum queue with quorum-native retry.
589
-
590
- This simplified helper enforces the required configuration for quorum-native retry:
591
- - Dead letter exchange is required (for failed messages)
592
- - Delivery limit is required (for retry count)
593
-
594
- #### Properties
595
-
596
- | Property | Type | Description | Defined in |
597
- | ------ | ------ | ------ | ------ |
598
- | <a id="arguments-1"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:421](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L421) |
599
- | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:416](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L416) |
600
- | <a id="deadletter"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration - required for retry support. Failed messages will be sent to this exchange. | [builder/queue.ts:404](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L404) |
601
- | <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:410](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L410) |
602
-
603
- ***
604
-
605
- ### DefineTtlBackoffQueueOptions
606
-
607
- ```ts
608
- type DefineTtlBackoffQueueOptions = object;
609
- ```
610
-
611
- Defined in: [builder/queue.ts:486](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L486)
612
-
613
- Options for creating a queue with TTL-backoff retry.
614
-
615
- This simplified helper enforces the required configuration for TTL-backoff retry:
616
- - Dead letter exchange is required (used for retry routing)
617
- - Returns infrastructure that includes wait queue and bindings
618
-
619
- #### Properties
620
-
621
- | Property | Type | Description | Defined in |
622
- | ------ | ------ | ------ | ------ |
623
- | <a id="arguments-2"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:532](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L532) |
624
- | <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:527](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L527) |
625
- | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:515](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L515) |
626
- | <a id="deadletter-1"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration - required for TTL-backoff retry. Used for routing messages to the wait queue and back. | [builder/queue.ts:491](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L491) |
627
- | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [builder/queue.ts:503](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L503) |
628
- | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [builder/queue.ts:521](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L521) |
629
- | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [builder/queue.ts:509](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L509) |
630
- | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:497](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L497) |
574
+ - Quorum queues (default): Do not support `exclusive`, `autoDelete`, or `maxPriority`
575
+ - Classic queues: Support all options including `exclusive`, `autoDelete`, and `maxPriority`
631
576
 
632
577
  ***
633
578
 
@@ -637,7 +582,7 @@ This simplified helper enforces the required configuration for TTL-backoff retry
637
582
  type DirectExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
638
583
  ```
639
584
 
640
- Defined in: [types.ts:439](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L439)
585
+ Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L459)
641
586
 
642
587
  A direct exchange definition.
643
588
 
@@ -648,7 +593,7 @@ This is ideal for point-to-point messaging where each message should go to speci
648
593
 
649
594
  | Name | Type | Defined in |
650
595
  | ------ | ------ | ------ |
651
- | `type` | `"direct"` | [types.ts:441](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L441) |
596
+ | `type` | `"direct"` | [types.ts:461](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L461) |
652
597
 
653
598
  #### Type Parameters
654
599
 
@@ -659,8 +604,8 @@ This is ideal for point-to-point messaging where each message should go to speci
659
604
  #### Example
660
605
 
661
606
  ```typescript
662
- const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct', {
663
- durable: true
607
+ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', {
608
+ type: 'direct',
664
609
  });
665
610
  ```
666
611
 
@@ -669,10 +614,10 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct'
669
614
  ### EventConsumerResult
670
615
 
671
616
  ```ts
672
- type EventConsumerResult<TMessage, TExchange, TQueue, TDlxExchange, TExchangeBinding, TBridgeExchange> = object;
617
+ type EventConsumerResult<TMessage, TExchange, TQueue, TExchangeBinding, TBridgeExchange> = object;
673
618
  ```
674
619
 
675
- Defined in: [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L56)
620
+ Defined in: [builder/event.ts:54](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L54)
676
621
 
677
622
  Result from defineEventConsumer.
678
623
 
@@ -686,8 +631,7 @@ will be automatically extracted.
686
631
  | ------ | ------ | ------ |
687
632
  | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
688
633
  | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | [`ExchangeDefinition`](#exchangedefinition) | - |
689
- | `TQueue` *extends* [`QueueDefinition`](#queuedefinition) | [`QueueDefinition`](#queuedefinition) | - |
690
- | `TDlxExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
634
+ | `TQueue` *extends* [`QueueEntry`](#queueentry) | [`QueueEntry`](#queueentry) | - |
691
635
  | `TExchangeBinding` *extends* [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | - |
692
636
  | `TBridgeExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
693
637
 
@@ -695,14 +639,13 @@ will be automatically extracted.
695
639
 
696
640
  | Property | Type | Description | Defined in |
697
641
  | ------ | ------ | ------ | ------ |
698
- | <a id="__brand-4"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:67](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L67) |
699
- | <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:71](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L71) |
700
- | <a id="bridgeexchange-2"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange when bridging, if configured | [builder/event.ts:81](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L81) |
701
- | <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing messages | [builder/event.ts:69](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L69) |
702
- | <a id="deadletterexchange-2"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/event.ts:77](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L77) |
703
- | <a id="exchange-3"></a> `exchange` | `TExchange` | The source exchange this consumer subscribes to | [builder/event.ts:73](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L73) |
704
- | <a id="exchangebinding-2"></a> `exchangeBinding` | `TExchangeBinding` | The exchange-to-exchange binding when bridging, if configured | [builder/event.ts:79](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L79) |
705
- | <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:75](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L75) |
642
+ | <a id="__brand-4"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:64](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L64) |
643
+ | <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:68](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L68) |
644
+ | <a id="bridgeexchange-2"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange when bridging, if configured | [builder/event.ts:76](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L76) |
645
+ | <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing messages | [builder/event.ts:66](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L66) |
646
+ | <a id="exchange-3"></a> `exchange` | `TExchange` | The source exchange this consumer subscribes to | [builder/event.ts:70](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L70) |
647
+ | <a id="exchangebinding-2"></a> `exchangeBinding` | `TExchangeBinding` | The exchange-to-exchange binding when bridging, if configured | [builder/event.ts:74](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L74) |
648
+ | <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:72](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L72) |
706
649
 
707
650
  ***
708
651
 
@@ -712,7 +655,7 @@ will be automatically extracted.
712
655
  type EventConsumerResultBase = object;
713
656
  ```
714
657
 
715
- Defined in: [types.ts:949](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L949)
658
+ Defined in: [types.ts:1006](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1006)
716
659
 
717
660
  Base type for event consumer result.
718
661
 
@@ -727,14 +670,13 @@ defineEventConsumer for creating event consumers
727
670
 
728
671
  | Property | Type | Defined in |
729
672
  | ------ | ------ | ------ |
730
- | <a id="__brand-5"></a> `__brand` | `"EventConsumerResult"` | [types.ts:950](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L950) |
731
- | <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:952](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L952) |
732
- | <a id="bridgeexchange-3"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:957](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L957) |
733
- | <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:951](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L951) |
734
- | <a id="deadletterexchange-3"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:955](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L955) |
735
- | <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:953](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L953) |
736
- | <a id="exchangebinding-3"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [types.ts:956](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L956) |
737
- | <a id="queue-4"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:954](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L954) |
673
+ | <a id="__brand-5"></a> `__brand` | `"EventConsumerResult"` | [types.ts:1007](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1007) |
674
+ | <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:1009](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1009) |
675
+ | <a id="bridgeexchange-3"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:1013](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1013) |
676
+ | <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:1008](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1008) |
677
+ | <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:1010](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1010) |
678
+ | <a id="exchangebinding-3"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [types.ts:1012](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1012) |
679
+ | <a id="queue-4"></a> `queue` | [`QueueEntry`](#queueentry) | [types.ts:1011](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1011) |
738
680
 
739
681
  ***
740
682
 
@@ -744,7 +686,7 @@ defineEventConsumer for creating event consumers
744
686
  type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
745
687
  ```
746
688
 
747
- Defined in: [builder/event.ts:30](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L30)
689
+ Defined in: [builder/event.ts:28](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L28)
748
690
 
749
691
  Configuration for an event publisher.
750
692
 
@@ -758,17 +700,17 @@ publishers broadcast events and consumers subscribe to receive them.
758
700
  | ------ | ------ | ------ |
759
701
  | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
760
702
  | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | - | The exchange definition |
761
- | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout) |
703
+ | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout and headers exchanges) |
762
704
 
763
705
  #### Properties
764
706
 
765
707
  | Property | Type | Description | Defined in |
766
708
  | ------ | ------ | ------ | ------ |
767
- | <a id="__brand-6"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L36) |
768
- | <a id="arguments-3"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments | [builder/event.ts:44](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L44) |
769
- | <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:38](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L38) |
770
- | <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L40) |
771
- | <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:42](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L42) |
709
+ | <a id="__brand-6"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:34](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L34) |
710
+ | <a id="arguments-1"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments | [builder/event.ts:42](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L42) |
711
+ | <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L36) |
712
+ | <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:38](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L38) |
713
+ | <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L40) |
772
714
 
773
715
  ***
774
716
 
@@ -778,7 +720,7 @@ publishers broadcast events and consumers subscribe to receive them.
778
720
  type EventPublisherConfigBase = object;
779
721
  ```
780
722
 
781
- Defined in: [types.ts:914](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L914)
723
+ Defined in: [types.ts:972](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L972)
782
724
 
783
725
  Base type for event publisher configuration.
784
726
 
@@ -793,11 +735,11 @@ defineEventPublisher for creating event publishers
793
735
 
794
736
  | Property | Type | Defined in |
795
737
  | ------ | ------ | ------ |
796
- | <a id="__brand-7"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:915](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L915) |
797
- | <a id="arguments-4"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | [types.ts:919](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L919) |
798
- | <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:916](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L916) |
799
- | <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:917](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L917) |
800
- | <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:918](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L918) |
738
+ | <a id="__brand-7"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:973](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L973) |
739
+ | <a id="arguments-2"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | [types.ts:977](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L977) |
740
+ | <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:974](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L974) |
741
+ | <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:975](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L975) |
742
+ | <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:976](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L976) |
801
743
 
802
744
  ***
803
745
 
@@ -812,11 +754,12 @@ type ExchangeBindingDefinition = object &
812
754
  }
813
755
  | {
814
756
  routingKey?: never;
815
- source: FanoutExchangeDefinition;
757
+ source: | FanoutExchangeDefinition
758
+ | HeadersExchangeDefinition;
816
759
  };
817
760
  ```
818
761
 
819
- Defined in: [types.ts:797](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L797)
762
+ Defined in: [types.ts:855](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L855)
820
763
 
821
764
  Binding between two exchanges (exchange-to-exchange routing).
822
765
 
@@ -827,9 +770,9 @@ This allows for more complex routing topologies.
827
770
 
828
771
  | Name | Type | Description | Defined in |
829
772
  | ------ | ------ | ------ | ------ |
830
- | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:807](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L807) |
831
- | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:802](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L802) |
832
- | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:799](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L799) |
773
+ | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:865](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L865) |
774
+ | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:860](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L860) |
775
+ | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:857](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L857) |
833
776
 
834
777
  #### Example
835
778
 
@@ -849,16 +792,17 @@ const binding: ExchangeBindingDefinition = {
849
792
 
850
793
  ```ts
851
794
  type ExchangeDefinition<TName> =
852
- | FanoutExchangeDefinition<TName>
795
+ | TopicExchangeDefinition<TName>
853
796
  | DirectExchangeDefinition<TName>
854
- | TopicExchangeDefinition<TName>;
797
+ | FanoutExchangeDefinition<TName>
798
+ | HeadersExchangeDefinition<TName>;
855
799
  ```
856
800
 
857
- Defined in: [types.ts:471](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L471)
801
+ Defined in: [types.ts:505](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L505)
858
802
 
859
803
  Union type of all exchange definitions.
860
804
 
861
- Represents any type of AMQP exchange: fanout, direct, or topic.
805
+ Represents any type of AMQP exchange: topic, direct, fanout, headers.
862
806
 
863
807
  #### Type Parameters
864
808
 
@@ -874,7 +818,7 @@ Represents any type of AMQP exchange: fanout, direct, or topic.
874
818
  type FanoutExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
875
819
  ```
876
820
 
877
- Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L421)
821
+ Defined in: [types.ts:477](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L477)
878
822
 
879
823
  A fanout exchange definition.
880
824
 
@@ -885,7 +829,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
885
829
 
886
830
  | Name | Type | Defined in |
887
831
  | ------ | ------ | ------ |
888
- | `type` | `"fanout"` | [types.ts:423](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L423) |
832
+ | `type` | `"fanout"` | [types.ts:479](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L479) |
889
833
 
890
834
  #### Type Parameters
891
835
 
@@ -896,20 +840,86 @@ This is the simplest exchange type for pub/sub messaging patterns.
896
840
  #### Example
897
841
 
898
842
  ```typescript
899
- const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout', {
900
- durable: true
843
+ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', {
844
+ type: 'fanout',
901
845
  });
902
846
  ```
903
847
 
904
848
  ***
905
849
 
850
+ ### HeadersExchangeDefinition
851
+
852
+ ```ts
853
+ type HeadersExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
854
+ ```
855
+
856
+ Defined in: [types.ts:495](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L495)
857
+
858
+ A headers exchange definition.
859
+
860
+ Headers exchanges route messages based on header values rather than routing keys.
861
+ This is useful for more complex routing scenarios where metadata is important.
862
+
863
+ #### Type Declaration
864
+
865
+ | Name | Type | Defined in |
866
+ | ------ | ------ | ------ |
867
+ | `type` | `"headers"` | [types.ts:497](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L497) |
868
+
869
+ #### Type Parameters
870
+
871
+ | Type Parameter | Default type |
872
+ | ------ | ------ |
873
+ | `TName` *extends* `string` | `string` |
874
+
875
+ #### Example
876
+
877
+ ```typescript
878
+ const routesExchange: HeadersExchangeDefinition = defineExchange('routes', {
879
+ type: 'headers',
880
+ });
881
+ ```
882
+
883
+ ***
884
+
885
+ ### ImmediateRequeueRetryOptions
886
+
887
+ ```ts
888
+ type ImmediateRequeueRetryOptions = object;
889
+ ```
890
+
891
+ Defined in: [types.ts:88](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L88)
892
+
893
+ Immediate-Requeue retry options.
894
+
895
+ Failed messages are requeued immediately.
896
+ For quorum queues, messages are requeued with `nack(requeue=true)`, and the worker tracks delivery count via the native RabbitMQ `x-delivery-count` header.
897
+ For classic queues, messages are re-published on the same queue, and the worker tracks delivery count via a custom `x-retry-count` header.
898
+ When the count exceeds `maxRetries`, the message is automatically dead-lettered (if DLX is configured) or dropped.
899
+
900
+ **Benefits:** Simpler architecture, no wait queues needed, no head-of-queue blocking.
901
+ **Limitation:** Immediate retries only (no exponential backoff).
902
+
903
+ #### See
904
+
905
+ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
906
+
907
+ #### Properties
908
+
909
+ | Property | Type | Description | Defined in |
910
+ | ------ | ------ | ------ | ------ |
911
+ | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:98](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L98) |
912
+ | <a id="mode"></a> `mode` | `"immediate-requeue"` | Immediate-Requeue mode. | [types.ts:92](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L92) |
913
+
914
+ ***
915
+
906
916
  ### InferConsumerNames
907
917
 
908
918
  ```ts
909
919
  type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
910
920
  ```
911
921
 
912
- Defined in: [types.ts:1491](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1491)
922
+ Defined in: [types.ts:1538](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1538)
913
923
 
914
924
  Extract consumer names from a contract.
915
925
 
@@ -941,7 +951,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
941
951
  type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
942
952
  ```
943
953
 
944
- Defined in: [types.ts:1473](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1473)
954
+ Defined in: [types.ts:1520](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1520)
945
955
 
946
956
  Extract publisher names from a contract.
947
957
 
@@ -973,7 +983,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
973
983
  type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
974
984
  ```
975
985
 
976
- Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/routing-types.ts#L114)
986
+ Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/routing-types.ts#L114)
977
987
 
978
988
  Validate that a routing key matches a binding pattern.
979
989
 
@@ -1005,7 +1015,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
1005
1015
  type MessageDefinition<TPayload, THeaders> = object;
1006
1016
  ```
1007
1017
 
1008
- Defined in: [types.ts:711](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L711)
1018
+ Defined in: [types.ts:769](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L769)
1009
1019
 
1010
1020
  Definition of a message with typed payload and optional headers.
1011
1021
 
@@ -1020,10 +1030,10 @@ Definition of a message with typed payload and optional headers.
1020
1030
 
1021
1031
  | Property | Type | Description | Defined in |
1022
1032
  | ------ | ------ | ------ | ------ |
1023
- | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:739](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L739) |
1024
- | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:727](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L727) |
1025
- | <a id="payload"></a> `payload` | `TPayload` | The payload schema for validating message content. Must be a Standard Schema v1 compatible schema (Zod, Valibot, ArkType, etc.). | [types.ts:721](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L721) |
1026
- | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:733](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L733) |
1033
+ | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:797](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L797) |
1034
+ | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:785](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L785) |
1035
+ | <a id="payload"></a> `payload` | `TPayload` | The payload schema for validating message content. Must be a Standard Schema v1 compatible schema (Zod, Valibot, ArkType, etc.). | [types.ts:779](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L779) |
1036
+ | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:791](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L791) |
1027
1037
 
1028
1038
  ***
1029
1039
 
@@ -1037,12 +1047,13 @@ type PublisherDefinition<TMessage> = object &
1037
1047
  routingKey: string;
1038
1048
  }
1039
1049
  | {
1040
- exchange: FanoutExchangeDefinition;
1050
+ exchange: | FanoutExchangeDefinition
1051
+ | HeadersExchangeDefinition;
1041
1052
  routingKey?: never;
1042
1053
  };
1043
1054
  ```
1044
1055
 
1045
- Defined in: [types.ts:855](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L855)
1056
+ Defined in: [types.ts:913](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L913)
1046
1057
 
1047
1058
  Definition of a message publisher.
1048
1059
 
@@ -1056,7 +1067,7 @@ algorithm when calling the publish method.
1056
1067
 
1057
1068
  | Name | Type | Description | Defined in |
1058
1069
  | ------ | ------ | ------ | ------ |
1059
- | `message` | `TMessage` | The message definition including the payload schema | [types.ts:857](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L857) |
1070
+ | `message` | `TMessage` | The message definition including the payload schema | [types.ts:915](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L915) |
1060
1071
 
1061
1072
  #### Type Parameters
1062
1073
 
@@ -1085,13 +1096,14 @@ type PublisherEntry =
1085
1096
  | BridgedPublisherConfigBase;
1086
1097
  ```
1087
1098
 
1088
- Defined in: [types.ts:1053](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L1053)
1099
+ Defined in: [types.ts:1110](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L1110)
1089
1100
 
1090
1101
  Publisher entry that can be passed to defineContract's publishers section.
1091
1102
 
1092
1103
  Can be either:
1093
1104
  - A plain PublisherDefinition from definePublisher
1094
1105
  - An EventPublisherConfig from defineEventPublisher (auto-extracted to publisher)
1106
+ - An BridgedPublisherConfig from defineCommandPublisher (auto-extracted to publisher)
1095
1107
 
1096
1108
  ***
1097
1109
 
@@ -1105,26 +1117,27 @@ type QueueBindingDefinition = object &
1105
1117
  routingKey: string;
1106
1118
  }
1107
1119
  | {
1108
- exchange: FanoutExchangeDefinition;
1120
+ exchange: | FanoutExchangeDefinition
1121
+ | HeadersExchangeDefinition;
1109
1122
  routingKey?: never;
1110
1123
  };
1111
1124
  ```
1112
1125
 
1113
- Defined in: [types.ts:749](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L749)
1126
+ Defined in: [types.ts:807](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L807)
1114
1127
 
1115
1128
  Binding between a queue and an exchange.
1116
1129
 
1117
1130
  Defines how messages from an exchange should be routed to a queue.
1118
1131
  For direct and topic exchanges, a routing key is required.
1119
- For fanout exchanges, no routing key is needed as all messages are broadcast.
1132
+ For fanout and headers exchanges, no routing key is needed.
1120
1133
 
1121
1134
  #### Type Declaration
1122
1135
 
1123
1136
  | Name | Type | Description | Defined in |
1124
1137
  | ------ | ------ | ------ | ------ |
1125
- | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:760](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L760) |
1126
- | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:754](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L754) |
1127
- | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:751](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L751) |
1138
+ | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:818](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L818) |
1139
+ | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:812](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L812) |
1140
+ | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:809](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L809) |
1128
1141
 
1129
1142
  ***
1130
1143
 
@@ -1136,7 +1149,7 @@ type QueueDefinition<TName> =
1136
1149
  | ClassicQueueDefinition<TName>;
1137
1150
  ```
1138
1151
 
1139
- Defined in: [types.ts:632](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L632)
1152
+ Defined in: [types.ts:646](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L646)
1140
1153
 
1141
1154
  Definition of an AMQP queue.
1142
1155
 
@@ -1162,7 +1175,7 @@ type QueueEntry<TName> =
1162
1175
  | QueueWithTtlBackoffInfrastructure<TName>;
1163
1176
  ```
1164
1177
 
1165
- Defined in: [types.ts:701](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L701)
1178
+ Defined in: [types.ts:749](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L749)
1166
1179
 
1167
1180
  A queue entry that can be passed to `defineContract`.
1168
1181
 
@@ -1182,7 +1195,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
1182
1195
  type QueueType = "quorum" | "classic";
1183
1196
  ```
1184
1197
 
1185
- Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L163)
1198
+ Defined in: [types.ts:227](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L227)
1186
1199
 
1187
1200
  Supported queue types in RabbitMQ.
1188
1201
 
@@ -1191,8 +1204,7 @@ Supported queue types in RabbitMQ.
1191
1204
  - `classic`: Classic queues - The traditional RabbitMQ queue type. Use only when you need
1192
1205
  specific features not supported by quorum queues (e.g., non-durable queues, priority queues).
1193
1206
 
1194
- Note: Quorum queues require `durable: true` and do not support `exclusive: true`.
1195
- When using quorum queues, `durable` is automatically set to `true`.
1207
+ Note: Quorum queues only support durable queues, and do not support exclusive, auto-deleting, or priority queues.
1196
1208
 
1197
1209
  #### See
1198
1210
 
@@ -1221,31 +1233,29 @@ const tempQueue = defineQueue('temp-queue', {
1221
1233
  type QueueWithTtlBackoffInfrastructure<TName> = object;
1222
1234
  ```
1223
1235
 
1224
- Defined in: [types.ts:662](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L662)
1236
+ Defined in: [types.ts:706](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L706)
1225
1237
 
1226
1238
  A queue with automatically generated TTL-backoff retry infrastructure.
1227
1239
 
1228
- This type is returned by `defineQueue` when TTL-backoff retry is configured
1229
- with a dead letter exchange. When passed to `defineContract`, the wait queue
1230
- and bindings are automatically added to the contract.
1240
+ This type is returned by `defineQueue` when TTL-backoff retry is configured.
1241
+ When passed to `defineContract`, the wait queue, exchanges, and bindings are
1242
+ automatically added to the contract.
1231
1243
 
1232
1244
  #### Example
1233
1245
 
1234
1246
  ```typescript
1235
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1236
- const exchange = defineExchange('orders', 'topic', { durable: true });
1247
+ const exchange = defineExchange('orders');
1237
1248
  const queue = defineQueue('order-processing', {
1238
- deadLetter: { exchange: dlx },
1239
1249
  retry: { mode: 'ttl-backoff', maxRetries: 5 },
1240
1250
  });
1241
1251
  // queue is QueueWithTtlBackoffInfrastructure
1242
1252
  const message = defineMessage(z.object({ orderId: z.string() }));
1243
1253
  const orderCreated = defineEventPublisher(exchange, message, { routingKey: 'order.created' });
1244
1254
 
1245
- // Wait queue, bindings, and DLX exchange are automatically extracted
1255
+ // Wait queue, exchanges, and bindings are automatically extracted
1246
1256
  const contract = defineContract({
1247
1257
  publishers: { orderCreated },
1248
- consumers: { processOrder: defineEventConsumer(orderCreated, extractQueue(queue)) },
1258
+ consumers: { processOrder: defineEventConsumer(orderCreated, queue) },
1249
1259
  });
1250
1260
  ```
1251
1261
 
@@ -1259,41 +1269,12 @@ const contract = defineContract({
1259
1269
 
1260
1270
  | Property | Type | Description | Defined in |
1261
1271
  | ------ | ------ | ------ | ------ |
1262
- | <a id="deadletter-2"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration from the main queue. Always present since TTL-backoff infrastructure requires a dead letter exchange. | [types.ts:678](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L678) |
1263
- | <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:693](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L693) |
1264
- | <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)&lt;`TName`&gt; | The main queue definition. | [types.ts:672](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L672) |
1265
- | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:683](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L683) |
1266
- | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:688](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L688) |
1267
-
1268
- ***
1269
-
1270
- ### QuorumNativeRetryOptions
1271
-
1272
- ```ts
1273
- type QuorumNativeRetryOptions = object;
1274
- ```
1275
-
1276
- Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L72)
1277
-
1278
- Quorum-Native retry options using RabbitMQ's native delivery limit feature.
1279
-
1280
- Uses quorum queue's `x-delivery-limit` feature. Messages are requeued immediately
1281
- with `nack(requeue=true)`, and RabbitMQ tracks delivery count via `x-delivery-count`
1282
- header. When the count exceeds the queue's `deliveryLimit`, the message is
1283
- automatically dead-lettered.
1284
-
1285
- **Benefits:** Simpler architecture, no wait queues needed, no head-of-queue blocking.
1286
- **Limitation:** Immediate retries only (no exponential backoff).
1287
-
1288
- #### See
1289
-
1290
- https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
1291
-
1292
- #### Properties
1293
-
1294
- | Property | Type | Description | Defined in |
1295
- | ------ | ------ | ------ | ------ |
1296
- | <a id="mode"></a> `mode` | `"quorum-native"` | Quorum-Native mode uses RabbitMQ's native delivery limit feature. Requires the queue to be a quorum queue with `deliveryLimit` configured. | [types.ts:77](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L77) |
1272
+ | <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)&lt;`TName`&gt; | The main queue definition. | [types.ts:716](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L716) |
1273
+ | <a id="retryexchange"></a> `retryExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Retry exchange used to route messages to retry back to the main queue. | [types.ts:731](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L731) |
1274
+ | <a id="retryqueuebinding"></a> `retryQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes messages to retry back to the main queue. | [types.ts:741](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L741) |
1275
+ | <a id="waitexchange"></a> `waitExchange` | [`HeadersExchangeDefinition`](#headersexchangedefinition) | Wait exchange used to route failed messages to the wait queue. | [types.ts:726](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L726) |
1276
+ | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:721](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L721) |
1277
+ | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:736](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L736) |
1297
1278
 
1298
1279
  ***
1299
1280
 
@@ -1303,22 +1284,21 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
1303
1284
  type QuorumQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
1304
1285
  ```
1305
1286
 
1306
- Defined in: [types.ts:545](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L545)
1287
+ Defined in: [types.ts:572](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L572)
1307
1288
 
1308
1289
  Definition of a quorum queue.
1309
1290
 
1310
1291
  Quorum queues provide better durability and high-availability using the Raft consensus algorithm.
1311
- They support native retry handling via `deliveryLimit` and both TTL-backoff and quorum-native retry modes.
1312
1292
 
1313
1293
  #### Type Declaration
1314
1294
 
1315
1295
  | Name | Type | Description | Defined in |
1316
1296
  | ------ | ------ | ------ | ------ |
1317
- | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. This is a quorum queue-specific feature. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling | [types.ts:575](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L575) |
1318
- | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:555](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L555) |
1319
- | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:561](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L561) |
1320
- | `retry` | [`ResolvedRetryOptions`](#resolvedretryoptions) | Retry configuration for handling failed message processing. Quorum queues support both: - `ttl-backoff`: Uses wait queues with exponential backoff (default) - `quorum-native`: Uses RabbitMQ's native delivery limit feature When the queue is created, defaults are applied for TTL-backoff options. | [types.ts:586](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L586) |
1321
- | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:549](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L549) |
1297
+ | `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:593](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L593) |
1298
+ | `durable` | `true` | Quorum queues only support durable queues. | [types.ts:581](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L581) |
1299
+ | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:587](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L587) |
1300
+ | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:599](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L599) |
1301
+ | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:576](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L576) |
1322
1302
 
1323
1303
  #### Type Parameters
1324
1304
 
@@ -1334,28 +1314,30 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
1334
1314
  type QuorumQueueOptions = BaseQueueOptions & object;
1335
1315
  ```
1336
1316
 
1337
- Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L214)
1317
+ Defined in: [types.ts:295](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L295)
1338
1318
 
1339
1319
  Options for creating a quorum queue.
1340
1320
 
1341
1321
  Quorum queues do not support:
1342
- - `exclusive` - Use classic queues for exclusive access
1322
+ - `exclusive` - Use classic queues for connection-scoped queues
1323
+ - `autoDelete` - Use classic queues for auto-deleting queues when consumers disconnect
1343
1324
  - `maxPriority` - Use classic queues for priority queues
1325
+ - `durable: false` - Use classic queues for non-durable queues
1344
1326
 
1345
- Quorum queues provide native retry support via `deliveryLimit`:
1327
+ Quorum queues provide native retry support for immediate-requeue retry mode:
1346
1328
  - RabbitMQ tracks delivery count automatically via `x-delivery-count` header
1347
- - When the limit is exceeded, messages are dead-lettered (if DLX is configured)
1329
+ - When the limit is exceeded, messages are dead-lettered (if DLX is configured) or dropped
1348
1330
  - This is simpler than TTL-based retry and avoids head-of-queue blocking issues
1349
1331
 
1350
1332
  #### Type Declaration
1351
1333
 
1352
1334
  | Name | Type | Description | Defined in |
1353
1335
  | ------ | ------ | ------ | ------ |
1354
- | `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. This is a quorum queue-specific feature that provides native retry handling without the complexity of TTL-based wait queues. **Benefits over TTL-based retry:** - Simpler architecture (no wait queues needed) - No head-of-queue blocking issues (TTL only works at queue head) - Native RabbitMQ feature with atomic guarantees **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling **Example** `const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, // Allow up to 5 delivery attempts deadLetter: { exchange: dlx, routingKey: 'order.failed', }, });` | [types.ts:263](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L263) |
1355
- | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:224](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L224) |
1356
- | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:230](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L230) |
1357
- | `retry?` | \| [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) \| [`QuorumNativeRetryOptions`](#quorumnativeretryoptions) | Retry configuration for handling failed message processing. Determines how the worker handles retries for consumers using this queue: - `"ttl-backoff"` (default): Uses wait queues with exponential backoff - `"quorum-native"`: Uses RabbitMQ's native delivery limit feature When using `"ttl-backoff"` mode, the core package will automatically create a wait queue (`{queueName}-wait`) and the necessary bindings. **Example** `// TTL-backoff mode with custom options const orderQueue = defineQueue('order-processing', { type: 'quorum', deadLetter: { exchange: dlx }, retry: { mode: 'ttl-backoff', maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, }); // Quorum-native mode const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, deadLetter: { exchange: dlx }, retry: { mode: 'quorum-native' }, });` | [types.ts:298](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L298) |
1358
- | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L218) |
1336
+ | `autoDelete?` | `never` | Quorum queues do not support auto-delete mode. Use type: 'classic' if you need auto-deleting queues. | [types.ts:316](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L316) |
1337
+ | `durable?` | `true` | Quorum queues only support durable queues. | [types.ts:304](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L304) |
1338
+ | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:310](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L310) |
1339
+ | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:322](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L322) |
1340
+ | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:299](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L299) |
1359
1341
 
1360
1342
  #### Example
1361
1343
 
@@ -1363,7 +1345,7 @@ Quorum queues provide native retry support via `deliveryLimit`:
1363
1345
  const orderQueue = defineQueue('orders', {
1364
1346
  type: 'quorum',
1365
1347
  deadLetter: { exchange: dlx },
1366
- deliveryLimit: 3, // Message dead-lettered after 3 delivery attempts
1348
+ retry: { mode: 'immediate-requeue', maxRetries: 3 } // Message dead-lettered after 3 retry attempts
1367
1349
  });
1368
1350
  ```
1369
1351
 
@@ -1373,17 +1355,22 @@ const orderQueue = defineQueue('orders', {
1373
1355
 
1374
1356
  ```ts
1375
1357
  type ResolvedRetryOptions =
1376
- | ResolvedTtlBackoffRetryOptions
1377
- | QuorumNativeRetryOptions;
1358
+ | NoneRetryOptions
1359
+ | ResolvedImmediateRequeueRetryOptions
1360
+ | ResolvedTtlBackoffRetryOptions;
1378
1361
  ```
1379
1362
 
1380
- Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L104)
1363
+ Defined in: [types.ts:166](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L166)
1381
1364
 
1382
1365
  Resolved retry configuration stored in queue definitions.
1383
1366
 
1384
1367
  This is a discriminated union based on the `mode` field:
1385
- - `ttl-backoff`: Has all TTL-backoff options with defaults applied
1386
- - `quorum-native`: No additional options (uses RabbitMQ native retry)
1368
+ - `none`: No retry attempts are made; failed messages are handled by DLQ/reject
1369
+ - `immediate-requeue`: Has all immediate-requeue retry options with default applied
1370
+ - `ttl-backoff`: Has all TTL-backoff retry options with defaults applied
1371
+
1372
+ When using `ttl-backoff` mode, the core package will automatically create
1373
+ a wait queue and the necessary exchanges and bindings.
1387
1374
 
1388
1375
  ***
1389
1376
 
@@ -1393,7 +1380,7 @@ This is a discriminated union based on the `mode` field:
1393
1380
  type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
1394
1381
  ```
1395
1382
 
1396
- Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/routing-types.ts#L25)
1383
+ Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/routing-types.ts#L25)
1397
1384
 
1398
1385
  Type-safe routing key that validates basic format.
1399
1386
 
@@ -1427,7 +1414,7 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
1427
1414
  type TopicExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
1428
1415
  ```
1429
1416
 
1430
- Defined in: [types.ts:461](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L461)
1417
+ Defined in: [types.ts:441](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L441)
1431
1418
 
1432
1419
  A topic exchange definition.
1433
1420
 
@@ -1441,7 +1428,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
1441
1428
 
1442
1429
  | Name | Type | Defined in |
1443
1430
  | ------ | ------ | ------ |
1444
- | `type` | `"topic"` | [types.ts:463](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L463) |
1431
+ | `type` | `"topic"` | [types.ts:443](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L443) |
1445
1432
 
1446
1433
  #### Type Parameters
1447
1434
 
@@ -1452,43 +1439,21 @@ Words are separated by dots (e.g., `order.created.high-value`).
1452
1439
  #### Example
1453
1440
 
1454
1441
  ```typescript
1455
- const ordersExchange: TopicExchangeDefinition = defineExchange('orders', 'topic', {
1456
- durable: true
1442
+ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', {
1443
+ type: 'topic', // This is the default type, so it can be omitted
1457
1444
  });
1458
1445
  // Can be bound with patterns like 'order.*' or 'order.#'
1459
1446
  ```
1460
1447
 
1461
1448
  ***
1462
1449
 
1463
- ### TtlBackoffRetryInfrastructure
1464
-
1465
- ```ts
1466
- type TtlBackoffRetryInfrastructure = object;
1467
- ```
1468
-
1469
- Defined in: [builder/ttl-backoff.ts:9](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/ttl-backoff.ts#L9)
1470
-
1471
- Result type for TTL-backoff retry infrastructure builder.
1472
-
1473
- Contains the wait queue and bindings needed for TTL-backoff retry.
1474
-
1475
- #### Properties
1476
-
1477
- | Property | Type | Description | Defined in |
1478
- | ------ | ------ | ------ | ------ |
1479
- | <a id="mainqueueretrybinding-1"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [builder/ttl-backoff.ts:22](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/ttl-backoff.ts#L22) |
1480
- | <a id="waitqueue-1"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. This is a classic queue with a dead letter exchange pointing back to the main queue. | [builder/ttl-backoff.ts:14](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/ttl-backoff.ts#L14) |
1481
- | <a id="waitqueuebinding-1"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [builder/ttl-backoff.ts:18](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/ttl-backoff.ts#L18) |
1482
-
1483
- ***
1484
-
1485
1450
  ### TtlBackoffRetryOptions
1486
1451
 
1487
1452
  ```ts
1488
1453
  type TtlBackoffRetryOptions = object;
1489
1454
  ```
1490
1455
 
1491
- Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L27)
1456
+ Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L27)
1492
1457
 
1493
1458
  TTL-Backoff retry options for exponential backoff with configurable delays.
1494
1459
 
@@ -1502,12 +1467,15 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
1502
1467
 
1503
1468
  | Property | Type | Description | Defined in |
1504
1469
  | ------ | ------ | ------ | ------ |
1505
- | <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L51) |
1506
- | <a id="initialdelayms-1"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:41](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L41) |
1507
- | <a id="jitter-1"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:56](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L56) |
1508
- | <a id="maxdelayms-1"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:46](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L46) |
1509
- | <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L36) |
1510
- | <a id="mode-1"></a> `mode` | `"ttl-backoff"` | TTL-Backoff mode uses wait queues with per-message TTL for exponential backoff. | [types.ts:31](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/types.ts#L31) |
1470
+ | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:52](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L52) |
1471
+ | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:42](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L42) |
1472
+ | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:57](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L57) |
1473
+ | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:47](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L47) |
1474
+ | <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Minimum** 1 - Must be a positive integer (1 or greater) **Default** `3` | [types.ts:37](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L37) |
1475
+ | <a id="mode-1"></a> `mode` | `"ttl-backoff"` | TTL-Backoff mode uses wait queues with per-message TTL for exponential backoff. | [types.ts:31](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L31) |
1476
+ | <a id="retryexchangename"></a> `retryExchangeName?` | `string` | Name of the retry exchange. **Default** `'retry-exchange'` | [types.ts:72](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L72) |
1477
+ | <a id="waitexchangename"></a> `waitExchangeName?` | `string` | Name of the wait exchange. **Default** `'wait-exchange'` | [types.ts:67](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L67) |
1478
+ | <a id="waitqueuename"></a> `waitQueueName?` | `string` | Name of the wait queue. **Default** `'{queueName}-wait'` | [types.ts:62](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/types.ts#L62) |
1511
1479
 
1512
1480
  ## Functions
1513
1481
 
@@ -1520,7 +1488,7 @@ function defineConsumer<TMessage>(
1520
1488
  options?): ConsumerDefinition<TMessage>;
1521
1489
  ```
1522
1490
 
1523
- Defined in: [builder/consumer.ts:121](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/consumer.ts#L121)
1491
+ Defined in: [builder/consumer.ts:120](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/consumer.ts#L120)
1524
1492
 
1525
1493
  Define a message consumer.
1526
1494
 
@@ -1568,7 +1536,7 @@ A consumer definition with inferred message types
1568
1536
  ```typescript
1569
1537
  import { z } from 'zod';
1570
1538
 
1571
- const orderQueue = defineQueue('order-processing', { durable: true });
1539
+ const orderQueue = defineQueue('order-processing');
1572
1540
  const orderMessage = defineMessage(
1573
1541
  z.object({
1574
1542
  orderId: z.string().uuid(),
@@ -1605,7 +1573,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
1605
1573
  function defineContract<TContract>(definition): ContractOutput<TContract>;
1606
1574
  ```
1607
1575
 
1608
- Defined in: [builder/contract.ts:82](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/contract.ts#L82)
1576
+ Defined in: [builder/contract.ts:82](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/contract.ts#L82)
1609
1577
 
1610
1578
  Define an AMQP contract.
1611
1579
 
@@ -1649,12 +1617,11 @@ import {
1649
1617
  import { z } from 'zod';
1650
1618
 
1651
1619
  // Define resources
1652
- const ordersExchange = defineExchange('orders', 'topic', { durable: true });
1653
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1620
+ const ordersExchange = defineExchange('orders');
1621
+ const dlx = defineExchange('orders-dlx', { type: 'direct' });
1654
1622
  const orderQueue = defineQueue('order-processing', {
1655
1623
  deadLetter: { exchange: dlx },
1656
- retry: { mode: 'quorum-native' },
1657
- deliveryLimit: 3,
1624
+ retry: { mode: 'immediate-requeue', maxRetries: 3 },
1658
1625
  });
1659
1626
  const orderMessage = defineMessage(
1660
1627
  z.object({
@@ -1694,7 +1661,7 @@ export const contract = defineContract({
1694
1661
  function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
1695
1662
  ```
1696
1663
 
1697
- Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/message.ts#L39)
1664
+ Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/message.ts#L39)
1698
1665
 
1699
1666
  Define a message definition with payload and optional headers/metadata.
1700
1667
 
@@ -1754,10 +1721,10 @@ const orderMessage = defineMessage(
1754
1721
  #### Call Signature
1755
1722
 
1756
1723
  ```ts
1757
- function defineQueue<TName, TDlx>(name, options): QueueDefinition<TName> | QueueWithTtlBackoffInfrastructure<TName> & object;
1724
+ function defineQueue<TName, TDlx>(name, options): QueueEntryWithDeadLetterExchange<TName, TDlx>;
1758
1725
  ```
1759
1726
 
1760
- Defined in: [builder/queue.ts:255](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L255)
1727
+ Defined in: [builder/queue.ts:113](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/queue.ts#L113)
1761
1728
 
1762
1729
  Define an AMQP queue.
1763
1730
 
@@ -1780,11 +1747,11 @@ or priority queues.
1780
1747
  | Parameter | Type | Description |
1781
1748
  | ------ | ------ | ------ |
1782
1749
  | `name` | `TName` | The name of the queue |
1783
- | `options` | [`DefineQueueOptions`](#definequeueoptions) & `object` | Optional queue configuration |
1750
+ | `options` | `DefineQueueOptionsWithDeadLetterExchange`&lt;`TDlx`&gt; | Optional queue configuration |
1784
1751
 
1785
1752
  ##### Returns
1786
1753
 
1787
- QueueDefinition\<TName\> \| QueueWithTtlBackoffInfrastructure\<TName\> & `object`
1754
+ `QueueEntryWithDeadLetterExchange`&lt;`TName`, `TDlx`&gt;
1788
1755
 
1789
1756
  A queue definition
1790
1757
 
@@ -1795,7 +1762,7 @@ A queue definition
1795
1762
  const orderQueue = defineQueue('order-processing');
1796
1763
 
1797
1764
  // Explicit quorum queue with dead letter exchange
1798
- const dlx = defineExchange('orders-dlx', 'topic', { durable: true });
1765
+ const dlx = defineExchange('orders-dlx');
1799
1766
  const orderQueueWithDLX = defineQueue('order-processing', {
1800
1767
  type: 'quorum',
1801
1768
  deadLetter: {
@@ -1817,12 +1784,11 @@ const tempQueue = defineQueue('temp-queue', {
1817
1784
  // Priority queue (requires classic type)
1818
1785
  const taskQueue = defineQueue('urgent-tasks', {
1819
1786
  type: 'classic',
1820
- durable: true,
1821
1787
  maxPriority: 10,
1822
1788
  });
1823
1789
 
1824
1790
  // Queue with TTL-backoff retry (returns infrastructure automatically)
1825
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1791
+ const dlx = defineExchange('orders-dlx', { type: 'direct' });
1826
1792
  const orderQueue = defineQueue('order-processing', {
1827
1793
  deadLetter: { exchange: dlx },
1828
1794
  retry: { mode: 'ttl-backoff', maxRetries: 5 },
@@ -1833,12 +1799,10 @@ const orderQueue = defineQueue('order-processing', {
1833
1799
  #### Call Signature
1834
1800
 
1835
1801
  ```ts
1836
- function defineQueue<TName>(name, options?):
1837
- | QueueDefinition<TName>
1838
- | QueueWithTtlBackoffInfrastructure<TName>;
1802
+ function defineQueue<TName>(name, options?): QueueEntry<TName>;
1839
1803
  ```
1840
1804
 
1841
- Defined in: [builder/queue.ts:262](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L262)
1805
+ Defined in: [builder/queue.ts:118](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/queue.ts#L118)
1842
1806
 
1843
1807
  Define an AMQP queue.
1844
1808
 
@@ -1864,8 +1828,7 @@ or priority queues.
1864
1828
 
1865
1829
  ##### Returns
1866
1830
 
1867
- \| [`QueueDefinition`](#queuedefinition)&lt;`TName`&gt;
1868
- \| [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)&lt;`TName`&gt;
1831
+ [`QueueEntry`](#queueentry)&lt;`TName`&gt;
1869
1832
 
1870
1833
  A queue definition
1871
1834
 
@@ -1876,7 +1839,7 @@ A queue definition
1876
1839
  const orderQueue = defineQueue('order-processing');
1877
1840
 
1878
1841
  // Explicit quorum queue with dead letter exchange
1879
- const dlx = defineExchange('orders-dlx', 'topic', { durable: true });
1842
+ const dlx = defineExchange('orders-dlx');
1880
1843
  const orderQueueWithDLX = defineQueue('order-processing', {
1881
1844
  type: 'quorum',
1882
1845
  deadLetter: {
@@ -1898,12 +1861,11 @@ const tempQueue = defineQueue('temp-queue', {
1898
1861
  // Priority queue (requires classic type)
1899
1862
  const taskQueue = defineQueue('urgent-tasks', {
1900
1863
  type: 'classic',
1901
- durable: true,
1902
1864
  maxPriority: 10,
1903
1865
  });
1904
1866
 
1905
1867
  // Queue with TTL-backoff retry (returns infrastructure automatically)
1906
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1868
+ const dlx = defineExchange('orders-dlx', { type: 'direct' });
1907
1869
  const orderQueue = defineQueue('order-processing', {
1908
1870
  deadLetter: { exchange: dlx },
1909
1871
  retry: { mode: 'ttl-backoff', maxRetries: 5 },
@@ -1913,215 +1875,13 @@ const orderQueue = defineQueue('order-processing', {
1913
1875
 
1914
1876
  ***
1915
1877
 
1916
- ### defineQuorumQueue()
1917
-
1918
- ```ts
1919
- function defineQuorumQueue<TName>(name, options): QuorumQueueDefinition<TName>;
1920
- ```
1921
-
1922
- Defined in: [builder/queue.ts:460](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L460)
1923
-
1924
- Create a quorum queue with quorum-native retry.
1925
-
1926
- This is a simplified helper that enforces best practices:
1927
- - Uses quorum queues (recommended for most use cases)
1928
- - Requires dead letter exchange for failed message handling
1929
- - Uses quorum-native retry mode (simpler than TTL-backoff)
1930
-
1931
- **When to use:**
1932
- - You want simple, immediate retries without exponential backoff
1933
- - You don't need configurable delays between retries
1934
- - You want the simplest retry configuration
1935
-
1936
- #### Type Parameters
1937
-
1938
- | Type Parameter |
1939
- | ------ |
1940
- | `TName` *extends* `string` |
1941
-
1942
- #### Parameters
1943
-
1944
- | Parameter | Type | Description |
1945
- | ------ | ------ | ------ |
1946
- | `name` | `TName` | The queue name |
1947
- | `options` | [`DefineQuorumQueueOptions`](#definequorumqueueoptions) | Configuration options |
1948
-
1949
- #### Returns
1950
-
1951
- [`QuorumQueueDefinition`](#quorumqueuedefinition)&lt;`TName`&gt;
1952
-
1953
- A quorum queue definition with quorum-native retry
1954
-
1955
- #### Example
1956
-
1957
- ```typescript
1958
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1959
-
1960
- const orderQueue = defineQuorumQueue('order-processing', {
1961
- deadLetter: { exchange: dlx },
1962
- deliveryLimit: 3, // Retry up to 3 times
1963
- });
1964
-
1965
- // Use in a contract — exchanges, queues, and bindings are auto-extracted
1966
- const contract = defineContract({
1967
- publishers: { ... },
1968
- consumers: { processOrder: defineEventConsumer(event, orderQueue) },
1969
- });
1970
- ```
1971
-
1972
- #### See
1973
-
1974
- - defineQueue - For full queue configuration options
1975
- - defineTtlBackoffQueue - For queues with exponential backoff retry
1976
-
1977
- ***
1978
-
1979
- ### defineTtlBackoffQueue()
1980
-
1981
- ```ts
1982
- function defineTtlBackoffQueue<TName>(name, options): QueueWithTtlBackoffInfrastructure<TName>;
1983
- ```
1984
-
1985
- Defined in: [builder/queue.ts:583](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L583)
1986
-
1987
- Create a queue with TTL-backoff retry (exponential backoff).
1988
-
1989
- This is a simplified helper that enforces best practices:
1990
- - Uses quorum queues (recommended for most use cases)
1991
- - Requires dead letter exchange for retry routing
1992
- - Uses TTL-backoff retry mode with configurable delays
1993
- - Automatically generates wait queue and bindings
1994
-
1995
- **When to use:**
1996
- - You need exponential backoff between retries
1997
- - You want configurable delays (initial delay, max delay, jitter)
1998
- - You're processing messages that may need time before retry
1999
-
2000
- **Returns:** A `QueueWithTtlBackoffInfrastructure` object that includes the
2001
- main queue, wait queue, and bindings. Pass this directly to `defineContract`
2002
- and it will be expanded automatically.
2003
-
2004
- #### Type Parameters
2005
-
2006
- | Type Parameter |
2007
- | ------ |
2008
- | `TName` *extends* `string` |
2009
-
2010
- #### Parameters
2011
-
2012
- | Parameter | Type | Description |
2013
- | ------ | ------ | ------ |
2014
- | `name` | `TName` | The queue name |
2015
- | `options` | [`DefineTtlBackoffQueueOptions`](#definettlbackoffqueueoptions) | Configuration options |
2016
-
2017
- #### Returns
2018
-
2019
- [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)&lt;`TName`&gt;
2020
-
2021
- A queue with TTL-backoff infrastructure
2022
-
2023
- #### Example
2024
-
2025
- ```typescript
2026
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
2027
-
2028
- const orderQueue = defineTtlBackoffQueue('order-processing', {
2029
- deadLetter: { exchange: dlx },
2030
- maxRetries: 5,
2031
- initialDelayMs: 1000, // Start with 1s delay
2032
- maxDelayMs: 30000, // Cap at 30s
2033
- });
2034
-
2035
- // Use in a contract — wait queue, bindings, and DLX are auto-extracted
2036
- const contract = defineContract({
2037
- publishers: { ... },
2038
- consumers: { processOrder: defineEventConsumer(event, extractQueue(orderQueue)) },
2039
- });
2040
-
2041
- // To access the underlying queue definition (e.g., for the queue name):
2042
- import { extractQueue } from '@amqp-contract/contract';
2043
- const queueName = extractQueue(orderQueue).name;
2044
- ```
2045
-
2046
- #### See
2047
-
2048
- - defineQueue - For full queue configuration options
2049
- - defineQuorumQueue - For queues with quorum-native retry (simpler, immediate retries)
2050
- - extractQueue - To access the underlying queue definition
2051
-
2052
- ***
2053
-
2054
- ### defineTtlBackoffRetryInfrastructure()
2055
-
2056
- ```ts
2057
- function defineTtlBackoffRetryInfrastructure(queueEntry, options?): TtlBackoffRetryInfrastructure;
2058
- ```
2059
-
2060
- Defined in: [builder/ttl-backoff.ts:67](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/ttl-backoff.ts#L67)
2061
-
2062
- Create TTL-backoff retry infrastructure for a queue.
2063
-
2064
- This builder helper generates the wait queue and bindings needed for TTL-backoff retry.
2065
- The generated infrastructure can be spread into a contract definition.
2066
-
2067
- TTL-backoff retry works by:
2068
- 1. Failed messages are sent to the DLX with routing key `{queueName}-wait`
2069
- 2. The wait queue receives these messages and holds them for a TTL period
2070
- 3. After TTL expires, messages are dead-lettered back to the DLX with routing key `{queueName}`
2071
- 4. The main queue receives the retried message via its binding to the DLX
2072
-
2073
- #### Parameters
2074
-
2075
- | Parameter | Type | Description |
2076
- | ------ | ------ | ------ |
2077
- | `queueEntry` | [`QueueEntry`](#queueentry) | - |
2078
- | `options?` | \{ `waitQueueDurable?`: `boolean`; \} | Optional configuration for the wait queue |
2079
- | `options.waitQueueDurable?` | `boolean` | Whether the wait queue should be durable (default: same as main queue) |
2080
-
2081
- #### Returns
2082
-
2083
- [`TtlBackoffRetryInfrastructure`](#ttlbackoffretryinfrastructure)
2084
-
2085
- TTL-backoff retry infrastructure containing wait queue and bindings
2086
-
2087
- #### Throws
2088
-
2089
- If the queue does not have a dead letter exchange configured
2090
-
2091
- #### Example
2092
-
2093
- ```typescript
2094
- const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
2095
- const orderQueue = defineQueue('order-processing', {
2096
- type: 'quorum',
2097
- deadLetter: { exchange: dlx },
2098
- retry: {
2099
- mode: 'ttl-backoff',
2100
- maxRetries: 5,
2101
- initialDelayMs: 1000,
2102
- },
2103
- });
2104
-
2105
- // Infrastructure is auto-extracted when using defineContract:
2106
- const contract = defineContract({
2107
- publishers: { ... },
2108
- consumers: { processOrder: defineEventConsumer(event, extractQueue(orderQueue)) },
2109
- });
2110
- // contract.queues includes the wait queue, contract.bindings includes retry bindings
2111
-
2112
- // Or generate manually for advanced use cases:
2113
- const retryInfra = defineTtlBackoffRetryInfrastructure(orderQueue);
2114
- ```
2115
-
2116
- ***
2117
-
2118
1878
  ### extractConsumer()
2119
1879
 
2120
1880
  ```ts
2121
1881
  function extractConsumer(entry): ConsumerDefinition;
2122
1882
  ```
2123
1883
 
2124
- Defined in: [builder/consumer.ts:55](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/consumer.ts#L55)
1884
+ Defined in: [builder/consumer.ts:54](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/consumer.ts#L54)
2125
1885
 
2126
1886
  Extract the ConsumerDefinition from any ConsumerEntry type.
2127
1887
 
@@ -2170,18 +1930,18 @@ extractConsumer(consumer3).queue.name; // "my-queue"
2170
1930
  function extractQueue<T>(entry): ExtractQueueFromEntry<T>;
2171
1931
  ```
2172
1932
 
2173
- Defined in: [builder/queue.ts:127](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L127)
1933
+ Defined in: [builder/queue-utils.ts:60](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/queue-utils.ts#L60)
2174
1934
 
2175
1935
  Extract the plain QueueDefinition from a QueueEntry.
2176
1936
 
2177
1937
  **Why this function exists:**
2178
- When you configure a queue with TTL-backoff retry and a dead letter exchange,
2179
- `defineQueue` (or `defineTtlBackoffQueue`) returns a wrapper object that includes
2180
- the main queue, wait queue, and bindings. This function extracts the underlying
1938
+ When you configure a queue with TTL-backoff retry,
1939
+ `defineQueue` returns a wrapper object that includes
1940
+ the main queue, wait queue, headers exchanges, and bindings. This function extracts the underlying
2181
1941
  queue definition so you can access properties like `name`, `type`, etc.
2182
1942
 
2183
1943
  **When to use:**
2184
- - When you need to access queue properties (name, type, deadLetter, etc.)
1944
+ - When you need to access queue properties (name, type, etc.)
2185
1945
  - When passing a queue to functions that expect a plain QueueDefinition
2186
1946
  - Works safely on both plain queues and infrastructure wrappers
2187
1947
 
@@ -2210,32 +1970,29 @@ The plain QueueDefinition
2210
1970
  #### Example
2211
1971
 
2212
1972
  ```typescript
2213
- import { defineQueue, defineTtlBackoffQueue, extractQueue } from '@amqp-contract/contract';
1973
+ import { defineQueue, extractQueue } from '@amqp-contract/contract';
2214
1974
 
2215
1975
  // TTL-backoff queue returns a wrapper
2216
- const orderQueue = defineTtlBackoffQueue('orders', {
2217
- deadLetter: { exchange: dlx },
2218
- maxRetries: 3,
1976
+ const orderQueue = defineQueue('orders', {
1977
+ retry: { mode: 'ttl-backoff', maxRetries: 3 },
2219
1978
  });
2220
1979
 
2221
1980
  // Use extractQueue to access the queue name
2222
1981
  const queueName = extractQueue(orderQueue).name; // 'orders'
2223
1982
 
2224
1983
  // Also works safely on plain queues
2225
- const plainQueue = defineQueue('simple', { type: 'quorum', retry: { mode: 'quorum-native' } });
1984
+ const plainQueue = defineQueue('simple', { type: 'quorum', retry: { mode: 'immediate-requeue' } });
2226
1985
  const plainName = extractQueue(plainQueue).name; // 'simple'
2227
1986
 
2228
1987
  // Access other properties
2229
1988
  const queueDef = extractQueue(orderQueue);
2230
1989
  console.log(queueDef.name); // 'orders'
2231
1990
  console.log(queueDef.type); // 'quorum'
2232
- console.log(queueDef.deadLetter); // { exchange: dlx, ... }
2233
1991
  ```
2234
1992
 
2235
1993
  #### See
2236
1994
 
2237
- - isQueueWithTtlBackoffInfrastructure - Type guard to check if extraction is needed
2238
- - defineTtlBackoffQueue - Creates queues with TTL-backoff infrastructure
1995
+ isQueueWithTtlBackoffInfrastructure - Type guard to check if extraction is needed
2239
1996
 
2240
1997
  ***
2241
1998
 
@@ -2245,7 +2002,7 @@ console.log(queueDef.deadLetter); // { exchange: dlx, ... }
2245
2002
  function isBridgedPublisherConfig(value): value is BridgedPublisherConfig<MessageDefinition, ExchangeDefinition, ExchangeDefinition>;
2246
2003
  ```
2247
2004
 
2248
- Defined in: [builder/command.ts:460](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L460)
2005
+ Defined in: [builder/command.ts:514](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L514)
2249
2006
 
2250
2007
  Type guard to check if a value is a BridgedPublisherConfig.
2251
2008
 
@@ -2266,10 +2023,10 @@ True if the value is a BridgedPublisherConfig
2266
2023
  ### isCommandConsumerConfig()
2267
2024
 
2268
2025
  ```ts
2269
- function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined, QueueDefinition, ExchangeDefinition | undefined>;
2026
+ function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined, QueueEntry>;
2270
2027
  ```
2271
2028
 
2272
- Defined in: [builder/command.ts:443](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/command.ts#L443)
2029
+ Defined in: [builder/command.ts:497](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/command.ts#L497)
2273
2030
 
2274
2031
  Type guard to check if a value is a CommandConsumerConfig.
2275
2032
 
@@ -2281,7 +2038,7 @@ Type guard to check if a value is a CommandConsumerConfig.
2281
2038
 
2282
2039
  #### Returns
2283
2040
 
2284
- value is CommandConsumerConfig\<MessageDefinition, ExchangeDefinition, string \| undefined, QueueDefinition, ExchangeDefinition \| undefined\>
2041
+ value is CommandConsumerConfig\<MessageDefinition, ExchangeDefinition, string \| undefined, QueueEntry\>
2285
2042
 
2286
2043
  True if the value is a CommandConsumerConfig
2287
2044
 
@@ -2290,10 +2047,10 @@ True if the value is a CommandConsumerConfig
2290
2047
  ### isEventConsumerResult()
2291
2048
 
2292
2049
  ```ts
2293
- function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition | undefined, ExchangeBindingDefinition | undefined, ExchangeDefinition | undefined>;
2050
+ function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueEntry, ExchangeBindingDefinition | undefined, ExchangeDefinition | undefined>;
2294
2051
  ```
2295
2052
 
2296
- Defined in: [builder/event.ts:526](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L526)
2053
+ Defined in: [builder/event.ts:616](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L616)
2297
2054
 
2298
2055
  Type guard to check if a value is an EventConsumerResult.
2299
2056
 
@@ -2305,7 +2062,7 @@ Type guard to check if a value is an EventConsumerResult.
2305
2062
 
2306
2063
  #### Returns
2307
2064
 
2308
- value is EventConsumerResult\<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition \| undefined, ExchangeBindingDefinition \| undefined, ExchangeDefinition \| undefined\>
2065
+ value is EventConsumerResult\<MessageDefinition, ExchangeDefinition, QueueEntry, ExchangeBindingDefinition \| undefined, ExchangeDefinition \| undefined\>
2309
2066
 
2310
2067
  True if the value is an EventConsumerResult
2311
2068
 
@@ -2317,7 +2074,7 @@ True if the value is an EventConsumerResult
2317
2074
  function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
2318
2075
  ```
2319
2076
 
2320
- Defined in: [builder/event.ts:509](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/event.ts#L509)
2077
+ Defined in: [builder/event.ts:599](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/event.ts#L599)
2321
2078
 
2322
2079
  Type guard to check if a value is an EventPublisherConfig.
2323
2080
 
@@ -2341,11 +2098,11 @@ True if the value is an EventPublisherConfig
2341
2098
  function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
2342
2099
  ```
2343
2100
 
2344
- Defined in: [builder/queue.ts:73](https://github.com/btravers/amqp-contract/blob/a5ff0e58db355e3410ea3b765884871c3b44c87d/packages/contract/src/builder/queue.ts#L73)
2101
+ Defined in: [builder/ttl-backoff.ts:43](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/contract/src/builder/ttl-backoff.ts#L43)
2345
2102
 
2346
2103
  Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
2347
2104
 
2348
- When you configure a queue with TTL-backoff retry and a dead letter exchange,
2105
+ When you configure a queue with TTL-backoff retry,
2349
2106
  `defineQueue` returns a `QueueWithTtlBackoffInfrastructure` instead of a plain
2350
2107
  `QueueDefinition`. This type guard helps you distinguish between the two.
2351
2108
 
@@ -2372,12 +2129,11 @@ True if the entry is a QueueWithTtlBackoffInfrastructure, false otherwise
2372
2129
 
2373
2130
  ```typescript
2374
2131
  const queue = defineQueue('orders', {
2375
- deadLetter: { exchange: dlx },
2376
2132
  retry: { mode: 'ttl-backoff' },
2377
2133
  });
2378
2134
 
2379
2135
  if (isQueueWithTtlBackoffInfrastructure(queue)) {
2380
- // queue has .queue, .waitQueue, .waitQueueBinding, .mainQueueRetryBinding
2136
+ // queue has .queue, .waitQueue, .waitQueueBinding, .retryQueueBinding, .waitExchange, .retryExchange
2381
2137
  console.log('Wait queue:', queue.waitQueue.name);
2382
2138
  } else {
2383
2139
  // queue is a plain QueueDefinition