@amqp-contract/contract 0.12.0 → 0.13.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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L12)
15
+ Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/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 = object;
33
33
  ```
34
34
 
35
- Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L376)
35
+ Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L376)
36
36
 
37
37
  Base definition of an AMQP exchange.
38
38
 
@@ -43,11 +43,11 @@ type and routing rules. This type contains properties common to all exchange typ
43
43
 
44
44
  | Property | Type | Description | Defined in |
45
45
  | ------ | ------ | ------ | ------ |
46
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L405) |
47
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L392) |
48
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L386) |
49
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L399) |
50
- | <a id="name"></a> `name` | `string` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L380) |
46
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L405) |
47
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L392) |
48
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L386) |
49
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L399) |
50
+ | <a id="name"></a> `name` | `string` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L380) |
51
51
 
52
52
  ***
53
53
 
@@ -59,7 +59,7 @@ type BindingDefinition =
59
59
  | ExchangeBindingDefinition;
60
60
  ```
61
61
 
62
- Defined in: [types.ts:815](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L815)
62
+ Defined in: [types.ts:815](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L815)
63
63
 
64
64
  Union type of all binding definitions.
65
65
 
@@ -75,7 +75,7 @@ A binding can be either:
75
75
  type BindingPattern<S> = S extends "" ? never : S;
76
76
  ```
77
77
 
78
- Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/routing-types.ts#L52)
78
+ Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L52)
79
79
 
80
80
  Type-safe binding pattern that validates basic format and wildcards.
81
81
 
@@ -110,7 +110,7 @@ type Invalid = BindingPattern<"">; // never (empty string)
110
110
  type ClassicQueueDefinition = BaseQueueDefinition & object;
111
111
  ```
112
112
 
113
- Defined in: [types.ts:592](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L592)
113
+ Defined in: [types.ts:592](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L592)
114
114
 
115
115
  Definition of a classic queue.
116
116
 
@@ -121,10 +121,10 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
121
121
 
122
122
  | Name | Type | Description | Defined in |
123
123
  | ------ | ------ | ------ | ------ |
124
- | `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:602](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L602) |
125
- | `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:609](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L609) |
126
- | `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:617](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L617) |
127
- | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:596](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L596) |
124
+ | `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:602](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L602) |
125
+ | `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:609](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L609) |
126
+ | `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:617](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L617) |
127
+ | `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:596](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L596) |
128
128
 
129
129
  ***
130
130
 
@@ -134,7 +134,7 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
134
134
  type ClassicQueueOptions = BaseQueueOptions & object;
135
135
  ```
136
136
 
137
- Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L318)
137
+ Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L318)
138
138
 
139
139
  Options for creating a classic queue.
140
140
 
@@ -147,10 +147,10 @@ Classic queues support all traditional RabbitMQ features including:
147
147
 
148
148
  | Name | Type | Description | Defined in |
149
149
  | ------ | ------ | ------ | ------ |
150
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L329) |
151
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L336) |
152
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L358) |
153
- | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L322) |
150
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L329) |
151
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L336) |
152
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L358) |
153
+ | `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L322) |
154
154
 
155
155
  #### Example
156
156
 
@@ -164,13 +164,77 @@ const priorityQueue = defineQueue('tasks', {
164
164
 
165
165
  ***
166
166
 
167
+ ### CommandConsumerConfig
168
+
169
+ ```ts
170
+ type CommandConsumerConfig<TMessage, TExchange, TRoutingKey> = object;
171
+ ```
172
+
173
+ Defined in: [builder/command.ts:27](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L27)
174
+
175
+ Configuration for a command consumer.
176
+
177
+ Commands are sent by one or more publishers to a single consumer (task queue pattern).
178
+ The consumer "owns" the queue, and publishers send commands to it.
179
+
180
+ #### Type Parameters
181
+
182
+ | Type Parameter | Default type | Description |
183
+ | ------ | ------ | ------ |
184
+ | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
185
+ | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | - | The exchange definition |
186
+ | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout) |
187
+
188
+ #### Properties
189
+
190
+ | Property | Type | Description | Defined in |
191
+ | ------ | ------ | ------ | ------ |
192
+ | <a id="__brand"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:33](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L33) |
193
+ | <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:37](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L37) |
194
+ | <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing commands | [builder/command.ts:35](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L35) |
195
+ | <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:39](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L39) |
196
+ | <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:41](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L41) |
197
+ | <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:43](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L43) |
198
+
199
+ ***
200
+
201
+ ### CommandConsumerConfigBase
202
+
203
+ ```ts
204
+ type CommandConsumerConfigBase = object;
205
+ ```
206
+
207
+ Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L912)
208
+
209
+ Base type for command consumer configuration.
210
+
211
+ This is a simplified type used in ContractDefinition. The full generic type
212
+ is defined in the builder module.
213
+
214
+ #### See
215
+
216
+ defineCommandConsumer for creating command consumers
217
+
218
+ #### Properties
219
+
220
+ | Property | Type | Defined in |
221
+ | ------ | ------ | ------ |
222
+ | <a id="__brand-1"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L913) |
223
+ | <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L915) |
224
+ | <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L914) |
225
+ | <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:916](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L916) |
226
+ | <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:917](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L917) |
227
+ | <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:918](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L918) |
228
+
229
+ ***
230
+
167
231
  ### CompressionAlgorithm
168
232
 
169
233
  ```ts
170
234
  type CompressionAlgorithm = "gzip" | "deflate";
171
235
  ```
172
236
 
173
- Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L134)
237
+ Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L134)
174
238
 
175
239
  Supported compression algorithms for message payloads.
176
240
 
@@ -208,7 +272,7 @@ await client.publish("orderCreated", payload, {
208
272
  type ConsumerDefinition<TMessage> = object;
209
273
  ```
210
274
 
211
- Defined in: [types.ts:876](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L876)
275
+ Defined in: [types.ts:876](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L876)
212
276
 
213
277
  Definition of a message consumer.
214
278
 
@@ -236,70 +300,28 @@ const consumer: ConsumerDefinition = {
236
300
 
237
301
  | Property | Type | Description | Defined in |
238
302
  | ------ | ------ | ------ | ------ |
239
- | <a id="message"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:881](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L881) |
240
- | <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:878](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L878) |
241
-
242
- ***
243
-
244
- ### ConsumerFirstResult
245
-
246
- ```ts
247
- type ConsumerFirstResult<TMessage, TConsumer, TBinding> = object;
248
- ```
249
-
250
- Defined in: [builder/consumer-first.ts:27](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L27)
251
-
252
- Consumer-first builder result for fanout and direct exchanges.
253
-
254
- This type represents a consumer with its binding and provides a method to create
255
- a publisher that uses the same message schema and routing key.
256
-
257
- #### Type Parameters
258
-
259
- | Type Parameter | Description |
260
- | ------ | ------ |
261
- | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
262
- | `TConsumer` *extends* [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition |
263
- | `TBinding` *extends* [`QueueBindingDefinition`](#queuebindingdefinition) | The queue binding definition |
264
-
265
- #### Properties
266
-
267
- | Property | Type | Description | Defined in |
268
- | ------ | ------ | ------ | ------ |
269
- | <a id="binding"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder/consumer-first.ts:35](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L35) |
270
- | <a id="consumer"></a> `consumer` | `TConsumer` | The consumer definition | [builder/consumer-first.ts:33](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L33) |
271
- | <a id="createpublisher"></a> `createPublisher` | () => `TBinding`\[`"exchange"`\] *extends* [`FanoutExchangeDefinition`](#fanoutexchangedefinition) ? `Extract`&lt;[`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt;, \{ `exchange`: [`FanoutExchangeDefinition`](#fanoutexchangedefinition); \}&gt; : `Extract`&lt;[`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt;, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}&gt; | Create a publisher that sends messages to this consumer. The publisher will automatically use the same message schema and routing key. | [builder/consumer-first.ts:42](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L42) |
303
+ | <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:881](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L881) |
304
+ | <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:878](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L878) |
272
305
 
273
306
  ***
274
307
 
275
- ### ConsumerFirstResultWithRoutingKey
308
+ ### ConsumerEntry
276
309
 
277
310
  ```ts
278
- type ConsumerFirstResultWithRoutingKey<TMessage, TConsumer, TBinding> = object;
311
+ type ConsumerEntry =
312
+ | ConsumerDefinition
313
+ | EventConsumerResultBase
314
+ | CommandConsumerConfigBase;
279
315
  ```
280
316
 
281
- Defined in: [builder/consumer-first.ts:60](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L60)
317
+ Defined in: [types.ts:1022](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1022)
282
318
 
283
- Consumer-first builder result for topic exchanges.
319
+ Consumer entry that can be passed to defineContract's consumers section.
284
320
 
285
- This type represents a consumer with its binding (which may use a pattern) and provides
286
- a method to create a publisher with a concrete routing key that matches the pattern.
287
-
288
- #### Type Parameters
289
-
290
- | Type Parameter | Description |
291
- | ------ | ------ |
292
- | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
293
- | `TConsumer` *extends* [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition |
294
- | `TBinding` *extends* [`QueueBindingDefinition`](#queuebindingdefinition) | The queue binding definition |
295
-
296
- #### Properties
297
-
298
- | Property | Type | Description | Defined in |
299
- | ------ | ------ | ------ | ------ |
300
- | <a id="binding-1"></a> `binding` | `TBinding` | The binding definition connecting the exchange to the queue | [builder/consumer-first.ts:68](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L68) |
301
- | <a id="consumer-1"></a> `consumer` | `TConsumer` | The consumer definition | [builder/consumer-first.ts:66](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L66) |
302
- | <a id="createpublisher-1"></a> `createPublisher` | &lt;`TPublisherRoutingKey`&gt;(`routingKey`) => `Extract`&lt;[`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt;, \{ `exchange`: \| [`DirectExchangeDefinition`](#directexchangedefinition) \| [`TopicExchangeDefinition`](#topicexchangedefinition); \}&gt; | Create a publisher that sends messages to this consumer. For topic exchanges, the routing key can be specified to match the binding pattern. | [builder/consumer-first.ts:76](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer-first.ts#L76) |
321
+ Can be either:
322
+ - A plain ConsumerDefinition from defineConsumer
323
+ - An EventConsumerResult from defineEventConsumer (binding auto-extracted)
324
+ - A CommandConsumerConfig from defineCommandConsumer (binding auto-extracted)
303
325
 
304
326
  ***
305
327
 
@@ -309,9 +331,9 @@ a method to create a publisher with a concrete routing key that matches the patt
309
331
  type ContractDefinition = object;
310
332
  ```
311
333
 
312
- Defined in: [types.ts:917](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L917)
334
+ Defined in: [types.ts:968](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L968)
313
335
 
314
- Complete AMQP contract definition.
336
+ Complete AMQP contract definition (output type).
315
337
 
316
338
  A contract brings together all AMQP resources into a single, type-safe definition.
317
339
  It defines the complete messaging topology including exchanges, queues, bindings,
@@ -348,11 +370,57 @@ const contract: ContractDefinition = {
348
370
 
349
371
  | Property | Type | Description | Defined in |
350
372
  | ------ | ------ | ------ | ------ |
351
- | <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:937](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L937) |
352
- | <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:951](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L951) |
353
- | <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:922](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L922) |
354
- | <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:944](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L944) |
355
- | <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:931](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L931) |
373
+ | <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:988](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L988) |
374
+ | <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:1002](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1002) |
375
+ | <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:973](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L973) |
376
+ | <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:995](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L995) |
377
+ | <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:982](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L982) |
378
+
379
+ ***
380
+
381
+ ### ContractDefinitionInput
382
+
383
+ ```ts
384
+ type ContractDefinitionInput = Omit<ContractDefinition, "publishers" | "consumers"> & object;
385
+ ```
386
+
387
+ Defined in: [types.ts:1054](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1054)
388
+
389
+ Contract definition input type with automatic extraction of event/command patterns.
390
+
391
+ This type allows passing event and command configs directly to the publishers
392
+ and consumers sections. `defineContract` will automatically extract the appropriate
393
+ definitions and generate bindings.
394
+
395
+ #### Type Declaration
396
+
397
+ | Name | Type | Description | Defined in |
398
+ | ------ | ------ | ------ | ------ |
399
+ | `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:1072](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1072) |
400
+ | `publishers?` | `Record`&lt;`string`, [`PublisherEntry`](#publisherentry)&gt; | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1062](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1062) |
401
+
402
+ #### Example
403
+
404
+ ```typescript
405
+ const contract = defineContract({
406
+ exchanges: { orders: ordersExchange },
407
+ queues: { processing: processingQueue },
408
+ publishers: {
409
+ // EventPublisherConfig → auto-extracted to publisher
410
+ orderCreated: defineEventPublisher(ordersExchange, orderMessage, { routingKey: "order.created" }),
411
+ },
412
+ consumers: {
413
+ // CommandConsumerConfig → auto-extracted to consumer + binding
414
+ processOrder: defineCommandConsumer(orderQueue, ordersExchange, orderMessage, { routingKey: "order.process" }),
415
+ // EventConsumerResult → auto-extracted to consumer + binding
416
+ notify: defineEventConsumer(orderCreatedEvent, notificationQueue),
417
+ },
418
+ });
419
+ ```
420
+
421
+ #### See
422
+
423
+ defineContract - Processes this input and returns a ContractDefinition
356
424
 
357
425
  ***
358
426
 
@@ -362,7 +430,7 @@ const contract: ContractDefinition = {
362
430
  type DeadLetterConfig = object;
363
431
  ```
364
432
 
365
- Defined in: [types.ts:480](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L480)
433
+ Defined in: [types.ts:480](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L480)
366
434
 
367
435
  Configuration for dead letter exchange (DLX) on a queue.
368
436
 
@@ -374,8 +442,8 @@ or storage.
374
442
 
375
443
  | Property | Type | Description | Defined in |
376
444
  | ------ | ------ | ------ | ------ |
377
- | <a id="exchange"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:485](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L485) |
378
- | <a id="routingkey"></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:491](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L491) |
445
+ | <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:485](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L485) |
446
+ | <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:491](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L491) |
379
447
 
380
448
  ***
381
449
 
@@ -387,7 +455,7 @@ type DefineQueueOptions =
387
455
  | ClassicQueueOptions;
388
456
  ```
389
457
 
390
- Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L368)
458
+ Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L368)
391
459
 
392
460
  Options for defining a queue. Uses a discriminated union based on the `type` property
393
461
  to enforce quorum queue constraints at compile time.
@@ -397,13 +465,69 @@ to enforce quorum queue constraints at compile time.
397
465
 
398
466
  ***
399
467
 
468
+ ### DefineQuorumQueueOptions
469
+
470
+ ```ts
471
+ type DefineQuorumQueueOptions = object;
472
+ ```
473
+
474
+ Defined in: [builder/queue.ts:376](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L376)
475
+
476
+ Options for creating a quorum queue with quorum-native retry.
477
+
478
+ This simplified helper enforces the required configuration for quorum-native retry:
479
+ - Dead letter exchange is required (for failed messages)
480
+ - Delivery limit is required (for retry count)
481
+
482
+ #### Properties
483
+
484
+ | Property | Type | Description | Defined in |
485
+ | ------ | ------ | ------ | ------ |
486
+ | <a id="arguments-1"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:403](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L403) |
487
+ | <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:398](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L398) |
488
+ | <a id="deadletterexchange"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter configuration - required for retry support. Failed messages will be sent to this exchange. | [builder/queue.ts:381](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L381) |
489
+ | <a id="deadletterroutingkey"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:386](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L386) |
490
+ | <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:392](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L392) |
491
+
492
+ ***
493
+
494
+ ### DefineTtlBackoffQueueOptions
495
+
496
+ ```ts
497
+ type DefineTtlBackoffQueueOptions = object;
498
+ ```
499
+
500
+ Defined in: [builder/queue.ts:478](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L478)
501
+
502
+ Options for creating a queue with TTL-backoff retry.
503
+
504
+ This simplified helper enforces the required configuration for TTL-backoff retry:
505
+ - Dead letter exchange is required (used for retry routing)
506
+ - Returns infrastructure that includes wait queue and bindings
507
+
508
+ #### Properties
509
+
510
+ | Property | Type | Description | Defined in |
511
+ | ------ | ------ | ------ | ------ |
512
+ | <a id="arguments-2"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:529](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L529) |
513
+ | <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:524](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L524) |
514
+ | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:512](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L512) |
515
+ | <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) | Dead letter exchange - required for TTL-backoff retry. Used for routing messages to the wait queue and back. | [builder/queue.ts:483](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L483) |
516
+ | <a id="deadletterroutingkey-1"></a> `deadLetterRoutingKey?` | `string` | Optional routing key for dead-lettered messages. | [builder/queue.ts:488](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L488) |
517
+ | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [builder/queue.ts:500](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L500) |
518
+ | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [builder/queue.ts:518](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L518) |
519
+ | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [builder/queue.ts:506](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L506) |
520
+ | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:494](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L494) |
521
+
522
+ ***
523
+
400
524
  ### DirectExchangeDefinition
401
525
 
402
526
  ```ts
403
527
  type DirectExchangeDefinition = BaseExchangeDefinition & object;
404
528
  ```
405
529
 
406
- Defined in: [types.ts:438](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L438)
530
+ Defined in: [types.ts:438](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L438)
407
531
 
408
532
  A direct exchange definition.
409
533
 
@@ -414,7 +538,7 @@ This is ideal for point-to-point messaging where each message should go to speci
414
538
 
415
539
  | Name | Type | Defined in |
416
540
  | ------ | ------ | ------ |
417
- | `type` | `"direct"` | [types.ts:439](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L439) |
541
+ | `type` | `"direct"` | [types.ts:439](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L439) |
418
542
 
419
543
  #### Example
420
544
 
@@ -426,6 +550,126 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct'
426
550
 
427
551
  ***
428
552
 
553
+ ### EventConsumerResult
554
+
555
+ ```ts
556
+ type EventConsumerResult<TMessage> = object;
557
+ ```
558
+
559
+ Defined in: [builder/event.ts:52](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L52)
560
+
561
+ Result from defineEventConsumer.
562
+
563
+ Contains the consumer definition and binding needed to subscribe to an event.
564
+ Can be used directly in defineContract's consumers section - the binding
565
+ will be automatically extracted.
566
+
567
+ #### Type Parameters
568
+
569
+ | Type Parameter | Description |
570
+ | ------ | ------ |
571
+ | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
572
+
573
+ #### Properties
574
+
575
+ | Property | Type | Description | Defined in |
576
+ | ------ | ------ | ------ | ------ |
577
+ | <a id="__brand-2"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:54](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L54) |
578
+ | <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:58](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L58) |
579
+ | <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)&lt;`TMessage`&gt; | The consumer definition for processing messages | [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L56) |
580
+
581
+ ***
582
+
583
+ ### EventConsumerResultBase
584
+
585
+ ```ts
586
+ type EventConsumerResultBase = object;
587
+ ```
588
+
589
+ Defined in: [types.ts:929](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L929)
590
+
591
+ Base type for event consumer result.
592
+
593
+ This is a simplified type used in ContractDefinitionInput. The full generic type
594
+ is defined in the builder module.
595
+
596
+ #### See
597
+
598
+ defineEventConsumer for creating event consumers
599
+
600
+ #### Properties
601
+
602
+ | Property | Type | Defined in |
603
+ | ------ | ------ | ------ |
604
+ | <a id="__brand-3"></a> `__brand` | `"EventConsumerResult"` | [types.ts:930](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L930) |
605
+ | <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L932) |
606
+ | <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L931) |
607
+
608
+ ***
609
+
610
+ ### EventPublisherConfig
611
+
612
+ ```ts
613
+ type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
614
+ ```
615
+
616
+ Defined in: [builder/event.ts:26](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L26)
617
+
618
+ Configuration for an event publisher.
619
+
620
+ Events are published without knowing who consumes them. Multiple consumers
621
+ can subscribe to the same event. This follows the pub/sub pattern where
622
+ publishers broadcast events and consumers subscribe to receive them.
623
+
624
+ #### Type Parameters
625
+
626
+ | Type Parameter | Default type | Description |
627
+ | ------ | ------ | ------ |
628
+ | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | - | The message definition |
629
+ | `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | - | The exchange definition |
630
+ | `TRoutingKey` *extends* `string` \| `undefined` | `undefined` | The routing key type (undefined for fanout) |
631
+
632
+ #### Properties
633
+
634
+ | Property | Type | Description | Defined in |
635
+ | ------ | ------ | ------ | ------ |
636
+ | <a id="__brand-4"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:32](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L32) |
637
+ | <a id="arguments-3"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L40) |
638
+ | <a id="exchange-3"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:34](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L34) |
639
+ | <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L36) |
640
+ | <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:38](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L38) |
641
+
642
+ ***
643
+
644
+ ### EventPublisherConfigBase
645
+
646
+ ```ts
647
+ type EventPublisherConfigBase = object;
648
+ ```
649
+
650
+ Defined in: [types.ts:896](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L896)
651
+
652
+ Base type for event publisher configuration.
653
+
654
+ This is a simplified type used in ContractDefinition. The full generic type
655
+ is defined in the builder module.
656
+
657
+ #### See
658
+
659
+ defineEventPublisher for creating event publishers
660
+
661
+ #### Properties
662
+
663
+ | Property | Type | Defined in |
664
+ | ------ | ------ | ------ |
665
+ | <a id="__brand-5"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:897](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L897) |
666
+ | <a id="arguments-4"></a> `arguments?` | `Record`&lt;`string`, `unknown`&gt; | [types.ts:901](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L901) |
667
+ | <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:898](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L898) |
668
+ | <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:899](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L899) |
669
+ | <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:900](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L900) |
670
+
671
+ ***
672
+
429
673
  ### ExchangeBindingDefinition
430
674
 
431
675
  ```ts
@@ -441,7 +685,7 @@ type ExchangeBindingDefinition = object &
441
685
  };
442
686
  ```
443
687
 
444
- Defined in: [types.ts:779](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L779)
688
+ Defined in: [types.ts:779](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L779)
445
689
 
446
690
  Binding between two exchanges (exchange-to-exchange routing).
447
691
 
@@ -452,9 +696,9 @@ This allows for more complex routing topologies.
452
696
 
453
697
  | Name | Type | Description | Defined in |
454
698
  | ------ | ------ | ------ | ------ |
455
- | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:789](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L789) |
456
- | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:784](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L784) |
457
- | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:781](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L781) |
699
+ | `arguments?` | `Record`&lt;`string`, `unknown`&gt; | Additional AMQP arguments for the binding. | [types.ts:789](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L789) |
700
+ | `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:784](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L784) |
701
+ | `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:781](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L781) |
458
702
 
459
703
  #### Example
460
704
 
@@ -479,7 +723,7 @@ type ExchangeDefinition =
479
723
  | TopicExchangeDefinition;
480
724
  ```
481
725
 
482
- Defined in: [types.ts:468](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L468)
726
+ Defined in: [types.ts:468](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L468)
483
727
 
484
728
  Union type of all exchange definitions.
485
729
 
@@ -493,7 +737,7 @@ Represents any type of AMQP exchange: fanout, direct, or topic.
493
737
  type FanoutExchangeDefinition = BaseExchangeDefinition & object;
494
738
  ```
495
739
 
496
- Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L421)
740
+ Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L421)
497
741
 
498
742
  A fanout exchange definition.
499
743
 
@@ -504,7 +748,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
504
748
 
505
749
  | Name | Type | Defined in |
506
750
  | ------ | ------ | ------ |
507
- | `type` | `"fanout"` | [types.ts:422](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L422) |
751
+ | `type` | `"fanout"` | [types.ts:422](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L422) |
508
752
 
509
753
  #### Example
510
754
 
@@ -522,7 +766,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout',
522
766
  type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
523
767
  ```
524
768
 
525
- Defined in: [types.ts:987](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L987)
769
+ Defined in: [types.ts:1108](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1108)
526
770
 
527
771
  Extract consumer names from a contract.
528
772
 
@@ -554,7 +798,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
554
798
  type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
555
799
  ```
556
800
 
557
- Defined in: [types.ts:969](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L969)
801
+ Defined in: [types.ts:1090](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1090)
558
802
 
559
803
  Extract publisher names from a contract.
560
804
 
@@ -586,7 +830,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
586
830
  type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
587
831
  ```
588
832
 
589
- Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/routing-types.ts#L114)
833
+ Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L114)
590
834
 
591
835
  Validate that a routing key matches a binding pattern.
592
836
 
@@ -618,7 +862,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
618
862
  type MessageDefinition<TPayload, THeaders> = object;
619
863
  ```
620
864
 
621
- Defined in: [types.ts:695](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L695)
865
+ Defined in: [types.ts:695](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L695)
622
866
 
623
867
  Definition of a message with typed payload and optional headers.
624
868
 
@@ -633,10 +877,10 @@ Definition of a message with typed payload and optional headers.
633
877
 
634
878
  | Property | Type | Description | Defined in |
635
879
  | ------ | ------ | ------ | ------ |
636
- | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:721](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L721) |
637
- | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:709](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L709) |
638
- | <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:703](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L703) |
639
- | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:715](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L715) |
880
+ | <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:721](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L721) |
881
+ | <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:709](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L709) |
882
+ | <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:703](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L703) |
883
+ | <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:715](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L715) |
640
884
 
641
885
  ***
642
886
 
@@ -655,7 +899,7 @@ type PublisherDefinition<TMessage> = object &
655
899
  };
656
900
  ```
657
901
 
658
- Defined in: [types.ts:837](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L837)
902
+ Defined in: [types.ts:837](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L837)
659
903
 
660
904
  Definition of a message publisher.
661
905
 
@@ -669,7 +913,7 @@ algorithm when calling the publish method.
669
913
 
670
914
  | Name | Type | Description | Defined in |
671
915
  | ------ | ------ | ------ | ------ |
672
- | `message` | `TMessage` | The message definition including the payload schema | [types.ts:839](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L839) |
916
+ | `message` | `TMessage` | The message definition including the payload schema | [types.ts:839](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L839) |
673
917
 
674
918
  #### Type Parameters
675
919
 
@@ -689,65 +933,21 @@ const publisher: PublisherDefinition = {
689
933
 
690
934
  ***
691
935
 
692
- ### PublisherFirstResult
693
-
694
- ```ts
695
- type PublisherFirstResult<TMessage, TPublisher> = object;
696
- ```
697
-
698
- Defined in: [builder/publisher-first.ts:29](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L29)
699
-
700
- Publisher-first builder result for fanout and direct exchanges.
701
-
702
- This type represents a publisher and provides a method to create
703
- a consumer that uses the same message schema with a binding to the exchange.
704
-
705
- This pattern is suitable for event-oriented messaging where publishers
706
- emit events without knowing which queues will consume them.
707
-
708
- #### Type Parameters
709
-
710
- | Type Parameter | Description |
711
- | ------ | ------ |
712
- | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
713
- | `TPublisher` *extends* [`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt; | The publisher definition |
714
-
715
- #### Properties
716
-
717
- | Property | Type | Description | Defined in |
718
- | ------ | ------ | ------ | ------ |
719
- | <a id="createconsumer"></a> `createConsumer` | (`queue`) => `object` | Create a consumer that receives messages from this publisher. The consumer will automatically use the same message schema and a binding will be created with the same routing key. | [builder/publisher-first.ts:43](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L43) |
720
- | <a id="publisher"></a> `publisher` | `TPublisher` | The publisher definition | [builder/publisher-first.ts:34](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L34) |
721
-
722
- ***
723
-
724
- ### PublisherFirstResultWithRoutingKey
936
+ ### PublisherEntry
725
937
 
726
938
  ```ts
727
- type PublisherFirstResultWithRoutingKey<TMessage, TPublisher, TRoutingKey> = object;
939
+ type PublisherEntry =
940
+ | PublisherDefinition
941
+ | EventPublisherConfigBase;
728
942
  ```
729
943
 
730
- Defined in: [builder/publisher-first.ts:59](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L59)
731
-
732
- Publisher-first builder result for topic exchanges.
944
+ Defined in: [types.ts:1012](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L1012)
733
945
 
734
- This type represents a publisher with a concrete routing key and provides a method
735
- to create consumers that can use routing key patterns matching the publisher's key.
946
+ Publisher entry that can be passed to defineContract's publishers section.
736
947
 
737
- #### Type Parameters
738
-
739
- | Type Parameter | Description |
740
- | ------ | ------ |
741
- | `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
742
- | `TPublisher` *extends* [`PublisherDefinition`](#publisherdefinition)&lt;`TMessage`&gt; | The publisher definition |
743
- | `TRoutingKey` *extends* `string` | The literal routing key type from the publisher (for documentation purposes) |
744
-
745
- #### Properties
746
-
747
- | Property | Type | Description | Defined in |
748
- | ------ | ------ | ------ | ------ |
749
- | <a id="createconsumer-1"></a> `createConsumer` | &lt;`TConsumerRoutingKey`&gt;(`queue`, `routingKey?`) => `object` | Create a consumer that receives messages from this publisher. For topic exchanges, the routing key pattern can be specified for the binding. | [builder/publisher-first.ts:74](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L74) |
750
- | <a id="publisher-1"></a> `publisher` | `TPublisher` | The publisher definition | [builder/publisher-first.ts:65](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/publisher-first.ts#L65) |
948
+ Can be either:
949
+ - A plain PublisherDefinition from definePublisher
950
+ - An EventPublisherConfig from defineEventPublisher (auto-extracted to publisher)
751
951
 
752
952
  ***
753
953
 
@@ -766,7 +966,7 @@ type QueueBindingDefinition = object &
766
966
  };
767
967
  ```
768
968
 
769
- Defined in: [types.ts:731](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L731)
969
+ Defined in: [types.ts:731](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L731)
770
970
 
771
971
  Binding between a queue and an exchange.
772
972
 
@@ -778,9 +978,9 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
778
978
 
779
979
  | Name | Type | Description | Defined in |
780
980
  | ------ | ------ | ------ | ------ |
781
- | `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:742](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L742) |
782
- | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:736](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L736) |
783
- | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:733](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L733) |
981
+ | `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:742](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L742) |
982
+ | `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:736](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L736) |
983
+ | `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:733](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L733) |
784
984
 
785
985
  ***
786
986
 
@@ -792,7 +992,7 @@ type QueueDefinition =
792
992
  | ClassicQueueDefinition;
793
993
  ```
794
994
 
795
- Defined in: [types.ts:629](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L629)
995
+ Defined in: [types.ts:629](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L629)
796
996
 
797
997
  Definition of an AMQP queue.
798
998
 
@@ -812,7 +1012,7 @@ type QueueEntry =
812
1012
  | QueueWithTtlBackoffInfrastructure;
813
1013
  ```
814
1014
 
815
- Defined in: [types.ts:687](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L687)
1015
+ Defined in: [types.ts:687](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L687)
816
1016
 
817
1017
  A queue entry that can be passed to `defineContract`.
818
1018
 
@@ -826,7 +1026,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
826
1026
  type QueueType = "quorum" | "classic";
827
1027
  ```
828
1028
 
829
- Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L163)
1029
+ Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L163)
830
1030
 
831
1031
  Supported queue types in RabbitMQ.
832
1032
 
@@ -865,7 +1065,7 @@ const tempQueue = defineQueue('temp-queue', {
865
1065
  type QueueWithTtlBackoffInfrastructure = object;
866
1066
  ```
867
1067
 
868
- Defined in: [types.ts:654](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L654)
1068
+ Defined in: [types.ts:654](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L654)
869
1069
 
870
1070
  A queue with automatically generated TTL-backoff retry infrastructure.
871
1071
 
@@ -894,10 +1094,10 @@ const contract = defineContract({
894
1094
 
895
1095
  | Property | Type | Description | Defined in |
896
1096
  | ------ | ------ | ------ | ------ |
897
- | <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:679](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L679) |
898
- | <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The main queue definition. | [types.ts:664](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L664) |
899
- | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:669](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L669) |
900
- | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:674](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L674) |
1097
+ | <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:679](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L679) |
1098
+ | <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The main queue definition. | [types.ts:664](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L664) |
1099
+ | <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:669](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L669) |
1100
+ | <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:674](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L674) |
901
1101
 
902
1102
  ***
903
1103
 
@@ -907,7 +1107,7 @@ const contract = defineContract({
907
1107
  type QuorumNativeRetryOptions = object;
908
1108
  ```
909
1109
 
910
- Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L72)
1110
+ Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L72)
911
1111
 
912
1112
  Quorum-Native retry options using RabbitMQ's native delivery limit feature.
913
1113
 
@@ -927,7 +1127,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
927
1127
 
928
1128
  | Property | Type | Description | Defined in |
929
1129
  | ------ | ------ | ------ | ------ |
930
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L77) |
1130
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L77) |
931
1131
 
932
1132
  ***
933
1133
 
@@ -937,7 +1137,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
937
1137
  type QuorumQueueDefinition = BaseQueueDefinition & object;
938
1138
  ```
939
1139
 
940
- Defined in: [types.ts:542](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L542)
1140
+ Defined in: [types.ts:542](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L542)
941
1141
 
942
1142
  Definition of a quorum queue.
943
1143
 
@@ -948,11 +1148,11 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
948
1148
 
949
1149
  | Name | Type | Description | Defined in |
950
1150
  | ------ | ------ | ------ | ------ |
951
- | `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:572](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L572) |
952
- | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:552](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L552) |
953
- | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:558](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L558) |
954
- | `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:583](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L583) |
955
- | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:546](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L546) |
1151
+ | `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:572](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L572) |
1152
+ | `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:552](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L552) |
1153
+ | `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:558](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L558) |
1154
+ | `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:583](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L583) |
1155
+ | `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:546](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L546) |
956
1156
 
957
1157
  ***
958
1158
 
@@ -962,7 +1162,7 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
962
1162
  type QuorumQueueOptions = BaseQueueOptions & object;
963
1163
  ```
964
1164
 
965
- Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L214)
1165
+ Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L214)
966
1166
 
967
1167
  Options for creating a quorum queue.
968
1168
 
@@ -979,11 +1179,11 @@ Quorum queues provide native retry support via `deliveryLimit`:
979
1179
 
980
1180
  | Name | Type | Description | Defined in |
981
1181
  | ------ | ------ | ------ | ------ |
982
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L263) |
983
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L224) |
984
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L230) |
985
- | `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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L298) |
986
- | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L218) |
1182
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L263) |
1183
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L224) |
1184
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L230) |
1185
+ | `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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L298) |
1186
+ | `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L218) |
987
1187
 
988
1188
  #### Example
989
1189
 
@@ -1005,7 +1205,7 @@ type ResolvedRetryOptions =
1005
1205
  | QuorumNativeRetryOptions;
1006
1206
  ```
1007
1207
 
1008
- Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L104)
1208
+ Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L104)
1009
1209
 
1010
1210
  Resolved retry configuration stored in queue definitions.
1011
1211
 
@@ -1021,7 +1221,7 @@ This is a discriminated union based on the `mode` field:
1021
1221
  type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
1022
1222
  ```
1023
1223
 
1024
- Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/routing-types.ts#L25)
1224
+ Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/routing-types.ts#L25)
1025
1225
 
1026
1226
  Type-safe routing key that validates basic format.
1027
1227
 
@@ -1055,7 +1255,7 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
1055
1255
  type TopicExchangeDefinition = BaseExchangeDefinition & object;
1056
1256
  ```
1057
1257
 
1058
- Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L459)
1258
+ Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L459)
1059
1259
 
1060
1260
  A topic exchange definition.
1061
1261
 
@@ -1069,7 +1269,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
1069
1269
 
1070
1270
  | Name | Type | Defined in |
1071
1271
  | ------ | ------ | ------ |
1072
- | `type` | `"topic"` | [types.ts:460](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L460) |
1272
+ | `type` | `"topic"` | [types.ts:460](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L460) |
1073
1273
 
1074
1274
  #### Example
1075
1275
 
@@ -1088,7 +1288,7 @@ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', 'topic'
1088
1288
  type TtlBackoffRetryInfrastructure = object;
1089
1289
  ```
1090
1290
 
1091
- Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/ttl-backoff.ts#L10)
1291
+ Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L10)
1092
1292
 
1093
1293
  Result type for TTL-backoff retry infrastructure builder.
1094
1294
 
@@ -1098,9 +1298,9 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
1098
1298
 
1099
1299
  | Property | Type | Description | Defined in |
1100
1300
  | ------ | ------ | ------ | ------ |
1101
- | <a id="mainqueueretrybinding-1"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [builder/ttl-backoff.ts:23](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/ttl-backoff.ts#L23) |
1102
- | <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:15](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/ttl-backoff.ts#L15) |
1103
- | <a id="waitqueuebinding-1"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [builder/ttl-backoff.ts:19](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/ttl-backoff.ts#L19) |
1301
+ | <a id="mainqueueretrybinding-1"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [builder/ttl-backoff.ts:23](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L23) |
1302
+ | <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:15](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L15) |
1303
+ | <a id="waitqueuebinding-1"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [builder/ttl-backoff.ts:19](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L19) |
1104
1304
 
1105
1305
  ***
1106
1306
 
@@ -1110,7 +1310,7 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
1110
1310
  type TtlBackoffRetryOptions = object;
1111
1311
  ```
1112
1312
 
1113
- Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L27)
1313
+ Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L27)
1114
1314
 
1115
1315
  TTL-Backoff retry options for exponential backoff with configurable delays.
1116
1316
 
@@ -1124,12 +1324,12 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
1124
1324
 
1125
1325
  | Property | Type | Description | Defined in |
1126
1326
  | ------ | ------ | ------ | ------ |
1127
- | <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L51) |
1128
- | <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:41](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L41) |
1129
- | <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:56](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L56) |
1130
- | <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:46](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L46) |
1131
- | <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L36) |
1132
- | <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/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/types.ts#L31) |
1327
+ | <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L51) |
1328
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L41) |
1329
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L56) |
1330
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L46) |
1331
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L36) |
1332
+ | <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/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/types.ts#L31) |
1133
1333
 
1134
1334
  ## Functions
1135
1335
 
@@ -1142,7 +1342,7 @@ function defineConsumer<TMessage>(
1142
1342
  options?): ConsumerDefinition<TMessage>;
1143
1343
  ```
1144
1344
 
1145
- Defined in: [builder/consumer.ts:46](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/consumer.ts#L46)
1345
+ Defined in: [builder/consumer.ts:62](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/consumer.ts#L62)
1146
1346
 
1147
1347
  Define a message consumer.
1148
1348
 
@@ -1152,6 +1352,19 @@ automatically when messages are consumed, ensuring type safety for your handlers
1152
1352
  Consumers are associated with a specific queue and message type. When you create a worker
1153
1353
  with this consumer, it will process messages from the queue according to the schema.
1154
1354
 
1355
+ **Which pattern to use:**
1356
+
1357
+ | Pattern | Best for | Description |
1358
+ |---------|----------|-------------|
1359
+ | `definePublisher` + `defineConsumer` | Independent definition | Define publishers and consumers separately with manual schema consistency |
1360
+ | `defineEventPublisher` + `defineEventConsumer` | Event broadcasting | Define event publisher first, create consumers that subscribe to it |
1361
+ | `defineCommandConsumer` + `defineCommandPublisher` | Task queues | Define command consumer first, create publishers that send commands to it |
1362
+
1363
+ Use `defineCommandConsumer` when:
1364
+ - One consumer receives from multiple publishers
1365
+ - You want automatic schema consistency between consumer and publishers
1366
+ - You're building task queue or command patterns
1367
+
1155
1368
  #### Type Parameters
1156
1369
 
1157
1370
  | Type Parameter |
@@ -1201,6 +1414,11 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
1201
1414
  // });
1202
1415
  ```
1203
1416
 
1417
+ #### See
1418
+
1419
+ - defineCommandConsumer - For task queue patterns with automatic schema consistency
1420
+ - defineEventPublisher - For event-driven patterns with automatic schema consistency
1421
+
1204
1422
  ***
1205
1423
 
1206
1424
  ### defineContract()
@@ -1209,7 +1427,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
1209
1427
  function defineContract<TContract>(definition): TContract;
1210
1428
  ```
1211
1429
 
1212
- Defined in: [builder/contract.ts:73](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/contract.ts#L73)
1430
+ Defined in: [builder/contract.ts:90](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/contract.ts#L90)
1213
1431
 
1214
1432
  Define an AMQP contract.
1215
1433
 
@@ -1224,7 +1442,7 @@ and publisher/consumer names from the contract.
1224
1442
 
1225
1443
  | Type Parameter |
1226
1444
  | ------ |
1227
- | `TContract` *extends* [`ContractDefinition`](#contractdefinition) |
1445
+ | `TContract` *extends* [`ContractDefinitionInput`](#contractdefinitioninput) |
1228
1446
 
1229
1447
  #### Parameters
1230
1448
 
@@ -1298,7 +1516,7 @@ export const contract = defineContract({
1298
1516
  function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
1299
1517
  ```
1300
1518
 
1301
- Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/message.ts#L39)
1519
+ Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/message.ts#L39)
1302
1520
 
1303
1521
  Define a message definition with payload and optional headers/metadata.
1304
1522
 
@@ -1361,7 +1579,7 @@ function defineQueue(name, options?):
1361
1579
  | QueueWithTtlBackoffInfrastructure;
1362
1580
  ```
1363
1581
 
1364
- Defined in: [builder/queue.ts:180](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/queue.ts#L180)
1582
+ Defined in: [builder/queue.ts:244](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L244)
1365
1583
 
1366
1584
  Define an AMQP queue.
1367
1585
 
@@ -1430,13 +1648,139 @@ const orderQueue = defineQueue('order-processing', {
1430
1648
 
1431
1649
  ***
1432
1650
 
1651
+ ### defineQuorumQueue()
1652
+
1653
+ ```ts
1654
+ function defineQuorumQueue(name, options): QuorumQueueDefinition;
1655
+ ```
1656
+
1657
+ Defined in: [builder/queue.ts:442](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L442)
1658
+
1659
+ Create a quorum queue with quorum-native retry.
1660
+
1661
+ This is a simplified helper that enforces best practices:
1662
+ - Uses quorum queues (recommended for most use cases)
1663
+ - Requires dead letter exchange for failed message handling
1664
+ - Uses quorum-native retry mode (simpler than TTL-backoff)
1665
+
1666
+ **When to use:**
1667
+ - You want simple, immediate retries without exponential backoff
1668
+ - You don't need configurable delays between retries
1669
+ - You want the simplest retry configuration
1670
+
1671
+ #### Parameters
1672
+
1673
+ | Parameter | Type | Description |
1674
+ | ------ | ------ | ------ |
1675
+ | `name` | `string` | The queue name |
1676
+ | `options` | [`DefineQuorumQueueOptions`](#definequorumqueueoptions) | Configuration options |
1677
+
1678
+ #### Returns
1679
+
1680
+ [`QuorumQueueDefinition`](#quorumqueuedefinition)
1681
+
1682
+ A quorum queue definition with quorum-native retry
1683
+
1684
+ #### Example
1685
+
1686
+ ```typescript
1687
+ const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1688
+
1689
+ const orderQueue = defineQuorumQueue('order-processing', {
1690
+ deadLetterExchange: dlx,
1691
+ deliveryLimit: 3, // Retry up to 3 times
1692
+ });
1693
+
1694
+ const contract = defineContract({
1695
+ exchanges: { dlx },
1696
+ queues: { orderProcessing: orderQueue },
1697
+ // ...
1698
+ });
1699
+ ```
1700
+
1701
+ #### See
1702
+
1703
+ - defineQueue - For full queue configuration options
1704
+ - defineTtlBackoffQueue - For queues with exponential backoff retry
1705
+
1706
+ ***
1707
+
1708
+ ### defineTtlBackoffQueue()
1709
+
1710
+ ```ts
1711
+ function defineTtlBackoffQueue(name, options): QueueWithTtlBackoffInfrastructure;
1712
+ ```
1713
+
1714
+ Defined in: [builder/queue.ts:580](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L580)
1715
+
1716
+ Create a queue with TTL-backoff retry (exponential backoff).
1717
+
1718
+ This is a simplified helper that enforces best practices:
1719
+ - Uses quorum queues (recommended for most use cases)
1720
+ - Requires dead letter exchange for retry routing
1721
+ - Uses TTL-backoff retry mode with configurable delays
1722
+ - Automatically generates wait queue and bindings
1723
+
1724
+ **When to use:**
1725
+ - You need exponential backoff between retries
1726
+ - You want configurable delays (initial delay, max delay, jitter)
1727
+ - You're processing messages that may need time before retry
1728
+
1729
+ **Returns:** A `QueueWithTtlBackoffInfrastructure` object that includes the
1730
+ main queue, wait queue, and bindings. Pass this directly to `defineContract`
1731
+ and it will be expanded automatically.
1732
+
1733
+ #### Parameters
1734
+
1735
+ | Parameter | Type | Description |
1736
+ | ------ | ------ | ------ |
1737
+ | `name` | `string` | The queue name |
1738
+ | `options` | [`DefineTtlBackoffQueueOptions`](#definettlbackoffqueueoptions) | Configuration options |
1739
+
1740
+ #### Returns
1741
+
1742
+ [`QueueWithTtlBackoffInfrastructure`](#queuewithttlbackoffinfrastructure)
1743
+
1744
+ A queue with TTL-backoff infrastructure
1745
+
1746
+ #### Example
1747
+
1748
+ ```typescript
1749
+ const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
1750
+
1751
+ const orderQueue = defineTtlBackoffQueue('order-processing', {
1752
+ deadLetterExchange: dlx,
1753
+ maxRetries: 5,
1754
+ initialDelayMs: 1000, // Start with 1s delay
1755
+ maxDelayMs: 30000, // Cap at 30s
1756
+ });
1757
+
1758
+ const contract = defineContract({
1759
+ exchanges: { dlx },
1760
+ queues: { orderProcessing: orderQueue }, // Wait queue auto-added
1761
+ // ... bindings auto-generated
1762
+ });
1763
+
1764
+ // To access the underlying queue definition (e.g., for the queue name):
1765
+ import { extractQueue } from '@amqp-contract/contract';
1766
+ const queueName = extractQueue(orderQueue).name;
1767
+ ```
1768
+
1769
+ #### See
1770
+
1771
+ - defineQueue - For full queue configuration options
1772
+ - defineQuorumQueue - For queues with quorum-native retry (simpler, immediate retries)
1773
+ - extractQueue - To access the underlying queue definition
1774
+
1775
+ ***
1776
+
1433
1777
  ### defineTtlBackoffRetryInfrastructure()
1434
1778
 
1435
1779
  ```ts
1436
1780
  function defineTtlBackoffRetryInfrastructure(queueEntry, options?): TtlBackoffRetryInfrastructure;
1437
1781
  ```
1438
1782
 
1439
- Defined in: [builder/ttl-backoff.ts:76](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/ttl-backoff.ts#L76)
1783
+ Defined in: [builder/ttl-backoff.ts:76](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/ttl-backoff.ts#L76)
1440
1784
 
1441
1785
  Create TTL-backoff retry infrastructure for a queue.
1442
1786
 
@@ -1508,11 +1852,24 @@ const contract = defineContract({
1508
1852
  function extractQueue(entry): QueueDefinition;
1509
1853
  ```
1510
1854
 
1511
- Defined in: [builder/queue.ts:62](https://github.com/btravers/amqp-contract/blob/c50b9d5f661ce899d34d7eebcfafa47844bd1087/packages/contract/src/builder/queue.ts#L62)
1855
+ Defined in: [builder/queue.ts:126](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L126)
1512
1856
 
1513
1857
  Extract the plain QueueDefinition from a QueueEntry.
1514
- If the entry is a QueueWithTtlBackoffInfrastructure, returns the inner queue.
1515
- Otherwise, returns the entry as-is.
1858
+
1859
+ **Why this function exists:**
1860
+ When you configure a queue with TTL-backoff retry and a dead letter exchange,
1861
+ `defineQueue` (or `defineTtlBackoffQueue`) returns a wrapper object that includes
1862
+ the main queue, wait queue, and bindings. This function extracts the underlying
1863
+ queue definition so you can access properties like `name`, `type`, etc.
1864
+
1865
+ **When to use:**
1866
+ - When you need to access queue properties (name, type, deadLetter, etc.)
1867
+ - When passing a queue to functions that expect a plain QueueDefinition
1868
+ - Works safely on both plain queues and infrastructure wrappers
1869
+
1870
+ **How it works:**
1871
+ - If the entry is a `QueueWithTtlBackoffInfrastructure`, returns `entry.queue`
1872
+ - Otherwise, returns the entry as-is (it's already a plain QueueDefinition)
1516
1873
 
1517
1874
  #### Parameters
1518
1875
 
@@ -1529,6 +1886,153 @@ The plain QueueDefinition
1529
1886
  #### Example
1530
1887
 
1531
1888
  ```typescript
1532
- const queue = defineQueue('orders', { retry: { mode: 'ttl-backoff' }, deadLetter: { exchange: dlx } });
1533
- const plainQueue = extractQueue(queue); // Returns the inner QueueDefinition
1889
+ import { defineQueue, defineTtlBackoffQueue, extractQueue } from '@amqp-contract/contract';
1890
+
1891
+ // TTL-backoff queue returns a wrapper
1892
+ const orderQueue = defineTtlBackoffQueue('orders', {
1893
+ deadLetterExchange: dlx,
1894
+ maxRetries: 3,
1895
+ });
1896
+
1897
+ // Use extractQueue to access the queue name
1898
+ const queueName = extractQueue(orderQueue).name; // 'orders'
1899
+
1900
+ // Also works safely on plain queues
1901
+ const plainQueue = defineQueue('simple', { type: 'quorum', retry: { mode: 'quorum-native' } });
1902
+ const plainName = extractQueue(plainQueue).name; // 'simple'
1903
+
1904
+ // Access other properties
1905
+ const queueDef = extractQueue(orderQueue);
1906
+ console.log(queueDef.name); // 'orders'
1907
+ console.log(queueDef.type); // 'quorum'
1908
+ console.log(queueDef.deadLetter); // { exchange: dlx, ... }
1909
+ ```
1910
+
1911
+ #### See
1912
+
1913
+ - isQueueWithTtlBackoffInfrastructure - Type guard to check if extraction is needed
1914
+ - defineTtlBackoffQueue - Creates queues with TTL-backoff infrastructure
1915
+
1916
+ ***
1917
+
1918
+ ### isCommandConsumerConfig()
1919
+
1920
+ ```ts
1921
+ function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
1922
+ ```
1923
+
1924
+ Defined in: [builder/command.ts:279](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/command.ts#L279)
1925
+
1926
+ Type guard to check if a value is a CommandConsumerConfig.
1927
+
1928
+ #### Parameters
1929
+
1930
+ | Parameter | Type | Description |
1931
+ | ------ | ------ | ------ |
1932
+ | `value` | `unknown` | The value to check |
1933
+
1934
+ #### Returns
1935
+
1936
+ value is CommandConsumerConfig\<MessageDefinition, ExchangeDefinition, string \| undefined\>
1937
+
1938
+ True if the value is a CommandConsumerConfig
1939
+
1940
+ ***
1941
+
1942
+ ### isEventConsumerResult()
1943
+
1944
+ ```ts
1945
+ function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition>;
1946
+ ```
1947
+
1948
+ Defined in: [builder/event.ts:338](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L338)
1949
+
1950
+ Type guard to check if a value is an EventConsumerResult.
1951
+
1952
+ #### Parameters
1953
+
1954
+ | Parameter | Type | Description |
1955
+ | ------ | ------ | ------ |
1956
+ | `value` | `unknown` | The value to check |
1957
+
1958
+ #### Returns
1959
+
1960
+ `value is EventConsumerResult<MessageDefinition>`
1961
+
1962
+ True if the value is an EventConsumerResult
1963
+
1964
+ ***
1965
+
1966
+ ### isEventPublisherConfig()
1967
+
1968
+ ```ts
1969
+ function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
1970
+ ```
1971
+
1972
+ Defined in: [builder/event.ts:321](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/event.ts#L321)
1973
+
1974
+ Type guard to check if a value is an EventPublisherConfig.
1975
+
1976
+ #### Parameters
1977
+
1978
+ | Parameter | Type | Description |
1979
+ | ------ | ------ | ------ |
1980
+ | `value` | `unknown` | The value to check |
1981
+
1982
+ #### Returns
1983
+
1984
+ value is EventPublisherConfig\<MessageDefinition, ExchangeDefinition, string \| undefined\>
1985
+
1986
+ True if the value is an EventPublisherConfig
1987
+
1988
+ ***
1989
+
1990
+ ### isQueueWithTtlBackoffInfrastructure()
1991
+
1992
+ ```ts
1993
+ function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
1994
+ ```
1995
+
1996
+ Defined in: [builder/queue.ts:67](https://github.com/btravers/amqp-contract/blob/69a6467d137997be809af2ea5c4332c378579b49/packages/contract/src/builder/queue.ts#L67)
1997
+
1998
+ Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
1999
+
2000
+ When you configure a queue with TTL-backoff retry and a dead letter exchange,
2001
+ `defineQueue` returns a `QueueWithTtlBackoffInfrastructure` instead of a plain
2002
+ `QueueDefinition`. This type guard helps you distinguish between the two.
2003
+
2004
+ **When to use:**
2005
+ - When you need to check the type of a queue entry at runtime
2006
+ - When writing generic code that handles both plain queues and infrastructure wrappers
2007
+
2008
+ **Related functions:**
2009
+ - `extractQueue()` - Use this to get the underlying queue definition from either type
2010
+
2011
+ #### Parameters
2012
+
2013
+ | Parameter | Type | Description |
2014
+ | ------ | ------ | ------ |
2015
+ | `entry` | [`QueueEntry`](#queueentry) | The queue entry to check |
2016
+
2017
+ #### Returns
2018
+
2019
+ `entry is QueueWithTtlBackoffInfrastructure`
2020
+
2021
+ True if the entry is a QueueWithTtlBackoffInfrastructure, false otherwise
2022
+
2023
+ #### Example
2024
+
2025
+ ```typescript
2026
+ const queue = defineQueue('orders', {
2027
+ deadLetter: { exchange: dlx },
2028
+ retry: { mode: 'ttl-backoff' },
2029
+ });
2030
+
2031
+ if (isQueueWithTtlBackoffInfrastructure(queue)) {
2032
+ // queue has .queue, .waitQueue, .waitQueueBinding, .mainQueueRetryBinding
2033
+ console.log('Wait queue:', queue.waitQueue.name);
2034
+ } else {
2035
+ // queue is a plain QueueDefinition
2036
+ console.log('Queue:', queue.name);
2037
+ }
1534
2038
  ```