@amqp-contract/contract 0.13.0 → 0.14.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/README.md +9 -13
- package/dist/index.cjs +47 -0
- package/dist/index.d.cts +37 -5
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +37 -5
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +47 -1
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +211 -162
- package/package.json +1 -1
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/
|
|
15
|
+
Defined in: [types.ts:12](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
35
|
+
Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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`<`string`, `unknown`> | 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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
46
|
+
| <a id="arguments"></a> `arguments?` | `Record`<`string`, `unknown`> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
62
|
+
Defined in: [types.ts:815](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
78
|
+
Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
113
|
+
Defined in: [types.ts:592](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
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/
|
|
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/
|
|
127
|
-
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:596](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L617) |
|
|
127
|
+
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:596](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
137
|
+
Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/
|
|
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/
|
|
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/
|
|
153
|
-
| `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L322) |
|
|
154
154
|
|
|
155
155
|
#### Example
|
|
156
156
|
|
|
@@ -170,7 +170,7 @@ const priorityQueue = defineQueue('tasks', {
|
|
|
170
170
|
type CommandConsumerConfig<TMessage, TExchange, TRoutingKey> = object;
|
|
171
171
|
```
|
|
172
172
|
|
|
173
|
-
Defined in: [builder/command.ts:27](https://github.com/btravers/amqp-contract/blob/
|
|
173
|
+
Defined in: [builder/command.ts:27](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/command.ts#L27)
|
|
174
174
|
|
|
175
175
|
Configuration for a command consumer.
|
|
176
176
|
|
|
@@ -189,12 +189,12 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
189
189
|
|
|
190
190
|
| Property | Type | Description | Defined in |
|
|
191
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/
|
|
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/
|
|
194
|
-
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:35](https://github.com/btravers/amqp-contract/blob/
|
|
195
|
-
| <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:39](https://github.com/btravers/amqp-contract/blob/
|
|
196
|
-
| <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:41](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/command.ts#L37) |
|
|
194
|
+
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:35](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/command.ts#L43) |
|
|
198
198
|
|
|
199
199
|
***
|
|
200
200
|
|
|
@@ -204,7 +204,7 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
204
204
|
type CommandConsumerConfigBase = object;
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
-
Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/
|
|
207
|
+
Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L912)
|
|
208
208
|
|
|
209
209
|
Base type for command consumer configuration.
|
|
210
210
|
|
|
@@ -219,12 +219,12 @@ defineCommandConsumer for creating command consumers
|
|
|
219
219
|
|
|
220
220
|
| Property | Type | Defined in |
|
|
221
221
|
| ------ | ------ | ------ |
|
|
222
|
-
| <a id="__brand-1"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/
|
|
223
|
-
| <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/
|
|
224
|
-
| <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/
|
|
225
|
-
| <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:916](https://github.com/btravers/amqp-contract/blob/
|
|
226
|
-
| <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:917](https://github.com/btravers/amqp-contract/blob/
|
|
227
|
-
| <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:918](https://github.com/btravers/amqp-contract/blob/
|
|
222
|
+
| <a id="__brand-1"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L918) |
|
|
228
228
|
|
|
229
229
|
***
|
|
230
230
|
|
|
@@ -234,7 +234,7 @@ defineCommandConsumer for creating command consumers
|
|
|
234
234
|
type CompressionAlgorithm = "gzip" | "deflate";
|
|
235
235
|
```
|
|
236
236
|
|
|
237
|
-
Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/
|
|
237
|
+
Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L134)
|
|
238
238
|
|
|
239
239
|
Supported compression algorithms for message payloads.
|
|
240
240
|
|
|
@@ -272,7 +272,7 @@ await client.publish("orderCreated", payload, {
|
|
|
272
272
|
type ConsumerDefinition<TMessage> = object;
|
|
273
273
|
```
|
|
274
274
|
|
|
275
|
-
Defined in: [types.ts:876](https://github.com/btravers/amqp-contract/blob/
|
|
275
|
+
Defined in: [types.ts:876](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L876)
|
|
276
276
|
|
|
277
277
|
Definition of a message consumer.
|
|
278
278
|
|
|
@@ -300,8 +300,8 @@ const consumer: ConsumerDefinition = {
|
|
|
300
300
|
|
|
301
301
|
| Property | Type | Description | Defined in |
|
|
302
302
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
304
|
-
| <a id="queue"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:878](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L878) |
|
|
305
305
|
|
|
306
306
|
***
|
|
307
307
|
|
|
@@ -314,7 +314,7 @@ type ConsumerEntry =
|
|
|
314
314
|
| CommandConsumerConfigBase;
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
-
Defined in: [types.ts:1022](https://github.com/btravers/amqp-contract/blob/
|
|
317
|
+
Defined in: [types.ts:1022](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1022)
|
|
318
318
|
|
|
319
319
|
Consumer entry that can be passed to defineContract's consumers section.
|
|
320
320
|
|
|
@@ -331,7 +331,7 @@ Can be either:
|
|
|
331
331
|
type ContractDefinition = object;
|
|
332
332
|
```
|
|
333
333
|
|
|
334
|
-
Defined in: [types.ts:968](https://github.com/btravers/amqp-contract/blob/
|
|
334
|
+
Defined in: [types.ts:968](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L968)
|
|
335
335
|
|
|
336
336
|
Complete AMQP contract definition (output type).
|
|
337
337
|
|
|
@@ -370,11 +370,11 @@ const contract: ContractDefinition = {
|
|
|
370
370
|
|
|
371
371
|
| Property | Type | Description | Defined in |
|
|
372
372
|
| ------ | ------ | ------ | ------ |
|
|
373
|
-
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:988](https://github.com/btravers/amqp-contract/blob/
|
|
374
|
-
| <a id="consumers"></a> `consumers?` | `Record`<`string`, [`ConsumerDefinition`](#consumerdefinition)> | 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/
|
|
375
|
-
| <a id="exchanges"></a> `exchanges?` | `Record`<`string`, [`ExchangeDefinition`](#exchangedefinition)> | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:973](https://github.com/btravers/amqp-contract/blob/
|
|
376
|
-
| <a id="publishers"></a> `publishers?` | `Record`<`string`, [`PublisherDefinition`](#publisherdefinition)> | 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/
|
|
377
|
-
| <a id="queues"></a> `queues?` | `Record`<`string`, [`QueueEntry`](#queueentry)> | 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/
|
|
373
|
+
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:988](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L988) |
|
|
374
|
+
| <a id="consumers"></a> `consumers?` | `Record`<`string`, [`ConsumerDefinition`](#consumerdefinition)> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1002) |
|
|
375
|
+
| <a id="exchanges"></a> `exchanges?` | `Record`<`string`, [`ExchangeDefinition`](#exchangedefinition)> | Named exchange definitions. Each key becomes available as a named resource in the contract. | [types.ts:973](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L973) |
|
|
376
|
+
| <a id="publishers"></a> `publishers?` | `Record`<`string`, [`PublisherDefinition`](#publisherdefinition)> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L995) |
|
|
377
|
+
| <a id="queues"></a> `queues?` | `Record`<`string`, [`QueueEntry`](#queueentry)> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L982) |
|
|
378
378
|
|
|
379
379
|
***
|
|
380
380
|
|
|
@@ -384,7 +384,7 @@ const contract: ContractDefinition = {
|
|
|
384
384
|
type ContractDefinitionInput = Omit<ContractDefinition, "publishers" | "consumers"> & object;
|
|
385
385
|
```
|
|
386
386
|
|
|
387
|
-
Defined in: [types.ts:1054](https://github.com/btravers/amqp-contract/blob/
|
|
387
|
+
Defined in: [types.ts:1054](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1054)
|
|
388
388
|
|
|
389
389
|
Contract definition input type with automatic extraction of event/command patterns.
|
|
390
390
|
|
|
@@ -396,8 +396,8 @@ definitions and generate bindings.
|
|
|
396
396
|
|
|
397
397
|
| Name | Type | Description | Defined in |
|
|
398
398
|
| ------ | ------ | ------ | ------ |
|
|
399
|
-
| `consumers?` | `Record`<`string`, [`ConsumerEntry`](#consumerentry)> | 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/
|
|
400
|
-
| `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | 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/
|
|
399
|
+
| `consumers?` | `Record`<`string`, [`ConsumerEntry`](#consumerentry)> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1072) |
|
|
400
|
+
| `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1062) |
|
|
401
401
|
|
|
402
402
|
#### Example
|
|
403
403
|
|
|
@@ -430,7 +430,7 @@ defineContract - Processes this input and returns a ContractDefinition
|
|
|
430
430
|
type DeadLetterConfig = object;
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
Defined in: [types.ts:480](https://github.com/btravers/amqp-contract/blob/
|
|
433
|
+
Defined in: [types.ts:480](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L480)
|
|
434
434
|
|
|
435
435
|
Configuration for dead letter exchange (DLX) on a queue.
|
|
436
436
|
|
|
@@ -442,8 +442,8 @@ or storage.
|
|
|
442
442
|
|
|
443
443
|
| Property | Type | Description | Defined in |
|
|
444
444
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L491) |
|
|
447
447
|
|
|
448
448
|
***
|
|
449
449
|
|
|
@@ -455,7 +455,7 @@ type DefineQueueOptions =
|
|
|
455
455
|
| ClassicQueueOptions;
|
|
456
456
|
```
|
|
457
457
|
|
|
458
|
-
Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/
|
|
458
|
+
Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L368)
|
|
459
459
|
|
|
460
460
|
Options for defining a queue. Uses a discriminated union based on the `type` property
|
|
461
461
|
to enforce quorum queue constraints at compile time.
|
|
@@ -471,7 +471,7 @@ to enforce quorum queue constraints at compile time.
|
|
|
471
471
|
type DefineQuorumQueueOptions = object;
|
|
472
472
|
```
|
|
473
473
|
|
|
474
|
-
Defined in: [builder/queue.ts:376](https://github.com/btravers/amqp-contract/blob/
|
|
474
|
+
Defined in: [builder/queue.ts:376](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L376)
|
|
475
475
|
|
|
476
476
|
Options for creating a quorum queue with quorum-native retry.
|
|
477
477
|
|
|
@@ -483,11 +483,11 @@ This simplified helper enforces the required configuration for quorum-native ret
|
|
|
483
483
|
|
|
484
484
|
| Property | Type | Description | Defined in |
|
|
485
485
|
| ------ | ------ | ------ | ------ |
|
|
486
|
-
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:403](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
486
|
+
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:403](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L392) |
|
|
491
491
|
|
|
492
492
|
***
|
|
493
493
|
|
|
@@ -497,7 +497,7 @@ This simplified helper enforces the required configuration for quorum-native ret
|
|
|
497
497
|
type DefineTtlBackoffQueueOptions = object;
|
|
498
498
|
```
|
|
499
499
|
|
|
500
|
-
Defined in: [builder/queue.ts:478](https://github.com/btravers/amqp-contract/blob/
|
|
500
|
+
Defined in: [builder/queue.ts:478](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L478)
|
|
501
501
|
|
|
502
502
|
Options for creating a queue with TTL-backoff retry.
|
|
503
503
|
|
|
@@ -509,15 +509,15 @@ This simplified helper enforces the required configuration for TTL-backoff retry
|
|
|
509
509
|
|
|
510
510
|
| Property | Type | Description | Defined in |
|
|
511
511
|
| ------ | ------ | ------ | ------ |
|
|
512
|
-
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:529](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
514
|
-
| <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:512](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
512
|
+
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:529](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L494) |
|
|
521
521
|
|
|
522
522
|
***
|
|
523
523
|
|
|
@@ -527,7 +527,7 @@ This simplified helper enforces the required configuration for TTL-backoff retry
|
|
|
527
527
|
type DirectExchangeDefinition = BaseExchangeDefinition & object;
|
|
528
528
|
```
|
|
529
529
|
|
|
530
|
-
Defined in: [types.ts:438](https://github.com/btravers/amqp-contract/blob/
|
|
530
|
+
Defined in: [types.ts:438](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L438)
|
|
531
531
|
|
|
532
532
|
A direct exchange definition.
|
|
533
533
|
|
|
@@ -538,7 +538,7 @@ This is ideal for point-to-point messaging where each message should go to speci
|
|
|
538
538
|
|
|
539
539
|
| Name | Type | Defined in |
|
|
540
540
|
| ------ | ------ | ------ |
|
|
541
|
-
| `type` | `"direct"` | [types.ts:439](https://github.com/btravers/amqp-contract/blob/
|
|
541
|
+
| `type` | `"direct"` | [types.ts:439](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L439) |
|
|
542
542
|
|
|
543
543
|
#### Example
|
|
544
544
|
|
|
@@ -556,7 +556,7 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct'
|
|
|
556
556
|
type EventConsumerResult<TMessage> = object;
|
|
557
557
|
```
|
|
558
558
|
|
|
559
|
-
Defined in: [builder/event.ts:52](https://github.com/btravers/amqp-contract/blob/
|
|
559
|
+
Defined in: [builder/event.ts:52](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L52)
|
|
560
560
|
|
|
561
561
|
Result from defineEventConsumer.
|
|
562
562
|
|
|
@@ -574,9 +574,9 @@ will be automatically extracted.
|
|
|
574
574
|
|
|
575
575
|
| Property | Type | Description | Defined in |
|
|
576
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/
|
|
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/
|
|
579
|
-
| <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing messages | [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L58) |
|
|
579
|
+
| <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing messages | [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L56) |
|
|
580
580
|
|
|
581
581
|
***
|
|
582
582
|
|
|
@@ -586,7 +586,7 @@ will be automatically extracted.
|
|
|
586
586
|
type EventConsumerResultBase = object;
|
|
587
587
|
```
|
|
588
588
|
|
|
589
|
-
Defined in: [types.ts:929](https://github.com/btravers/amqp-contract/blob/
|
|
589
|
+
Defined in: [types.ts:929](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L929)
|
|
590
590
|
|
|
591
591
|
Base type for event consumer result.
|
|
592
592
|
|
|
@@ -601,9 +601,9 @@ defineEventConsumer for creating event consumers
|
|
|
601
601
|
|
|
602
602
|
| Property | Type | Defined in |
|
|
603
603
|
| ------ | ------ | ------ |
|
|
604
|
-
| <a id="__brand-3"></a> `__brand` | `"EventConsumerResult"` | [types.ts:930](https://github.com/btravers/amqp-contract/blob/
|
|
605
|
-
| <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/
|
|
606
|
-
| <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/
|
|
604
|
+
| <a id="__brand-3"></a> `__brand` | `"EventConsumerResult"` | [types.ts:930](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L931) |
|
|
607
607
|
|
|
608
608
|
***
|
|
609
609
|
|
|
@@ -613,7 +613,7 @@ defineEventConsumer for creating event consumers
|
|
|
613
613
|
type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
|
|
614
614
|
```
|
|
615
615
|
|
|
616
|
-
Defined in: [builder/event.ts:26](https://github.com/btravers/amqp-contract/blob/
|
|
616
|
+
Defined in: [builder/event.ts:26](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L26)
|
|
617
617
|
|
|
618
618
|
Configuration for an event publisher.
|
|
619
619
|
|
|
@@ -633,11 +633,11 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
633
633
|
|
|
634
634
|
| Property | Type | Description | Defined in |
|
|
635
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/
|
|
637
|
-
| <a id="arguments-3"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/
|
|
638
|
-
| <a id="exchange-3"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:34](https://github.com/btravers/amqp-contract/blob/
|
|
639
|
-
| <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L32) |
|
|
637
|
+
| <a id="arguments-3"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L38) |
|
|
641
641
|
|
|
642
642
|
***
|
|
643
643
|
|
|
@@ -647,7 +647,7 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
647
647
|
type EventPublisherConfigBase = object;
|
|
648
648
|
```
|
|
649
649
|
|
|
650
|
-
Defined in: [types.ts:896](https://github.com/btravers/amqp-contract/blob/
|
|
650
|
+
Defined in: [types.ts:896](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L896)
|
|
651
651
|
|
|
652
652
|
Base type for event publisher configuration.
|
|
653
653
|
|
|
@@ -662,11 +662,11 @@ defineEventPublisher for creating event publishers
|
|
|
662
662
|
|
|
663
663
|
| Property | Type | Defined in |
|
|
664
664
|
| ------ | ------ | ------ |
|
|
665
|
-
| <a id="__brand-5"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:897](https://github.com/btravers/amqp-contract/blob/
|
|
666
|
-
| <a id="arguments-4"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:901](https://github.com/btravers/amqp-contract/blob/
|
|
667
|
-
| <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:898](https://github.com/btravers/amqp-contract/blob/
|
|
668
|
-
| <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:899](https://github.com/btravers/amqp-contract/blob/
|
|
669
|
-
| <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:900](https://github.com/btravers/amqp-contract/blob/
|
|
665
|
+
| <a id="__brand-5"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:897](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L897) |
|
|
666
|
+
| <a id="arguments-4"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:901](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L900) |
|
|
670
670
|
|
|
671
671
|
***
|
|
672
672
|
|
|
@@ -685,7 +685,7 @@ type ExchangeBindingDefinition = object &
|
|
|
685
685
|
};
|
|
686
686
|
```
|
|
687
687
|
|
|
688
|
-
Defined in: [types.ts:779](https://github.com/btravers/amqp-contract/blob/
|
|
688
|
+
Defined in: [types.ts:779](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L779)
|
|
689
689
|
|
|
690
690
|
Binding between two exchanges (exchange-to-exchange routing).
|
|
691
691
|
|
|
@@ -696,9 +696,9 @@ This allows for more complex routing topologies.
|
|
|
696
696
|
|
|
697
697
|
| Name | Type | Description | Defined in |
|
|
698
698
|
| ------ | ------ | ------ | ------ |
|
|
699
|
-
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:789](https://github.com/btravers/amqp-contract/blob/
|
|
700
|
-
| `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:784](https://github.com/btravers/amqp-contract/blob/
|
|
701
|
-
| `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:781](https://github.com/btravers/amqp-contract/blob/
|
|
699
|
+
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:789](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L781) |
|
|
702
702
|
|
|
703
703
|
#### Example
|
|
704
704
|
|
|
@@ -723,7 +723,7 @@ type ExchangeDefinition =
|
|
|
723
723
|
| TopicExchangeDefinition;
|
|
724
724
|
```
|
|
725
725
|
|
|
726
|
-
Defined in: [types.ts:468](https://github.com/btravers/amqp-contract/blob/
|
|
726
|
+
Defined in: [types.ts:468](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L468)
|
|
727
727
|
|
|
728
728
|
Union type of all exchange definitions.
|
|
729
729
|
|
|
@@ -737,7 +737,7 @@ Represents any type of AMQP exchange: fanout, direct, or topic.
|
|
|
737
737
|
type FanoutExchangeDefinition = BaseExchangeDefinition & object;
|
|
738
738
|
```
|
|
739
739
|
|
|
740
|
-
Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/
|
|
740
|
+
Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L421)
|
|
741
741
|
|
|
742
742
|
A fanout exchange definition.
|
|
743
743
|
|
|
@@ -748,7 +748,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
|
|
|
748
748
|
|
|
749
749
|
| Name | Type | Defined in |
|
|
750
750
|
| ------ | ------ | ------ |
|
|
751
|
-
| `type` | `"fanout"` | [types.ts:422](https://github.com/btravers/amqp-contract/blob/
|
|
751
|
+
| `type` | `"fanout"` | [types.ts:422](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L422) |
|
|
752
752
|
|
|
753
753
|
#### Example
|
|
754
754
|
|
|
@@ -766,7 +766,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout',
|
|
|
766
766
|
type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
|
|
767
767
|
```
|
|
768
768
|
|
|
769
|
-
Defined in: [types.ts:1108](https://github.com/btravers/amqp-contract/blob/
|
|
769
|
+
Defined in: [types.ts:1108](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1108)
|
|
770
770
|
|
|
771
771
|
Extract consumer names from a contract.
|
|
772
772
|
|
|
@@ -777,7 +777,7 @@ It's used internally for type inference in the TypedAmqpWorker.
|
|
|
777
777
|
|
|
778
778
|
| Type Parameter | Description |
|
|
779
779
|
| ------ | ------ |
|
|
780
|
-
| `TContract` *extends* [`
|
|
780
|
+
| `TContract` *extends* [`ContractDefinitionInput`](#contractdefinitioninput) | The contract definition |
|
|
781
781
|
|
|
782
782
|
#### Returns
|
|
783
783
|
|
|
@@ -798,7 +798,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
|
|
|
798
798
|
type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
|
|
799
799
|
```
|
|
800
800
|
|
|
801
|
-
Defined in: [types.ts:1090](https://github.com/btravers/amqp-contract/blob/
|
|
801
|
+
Defined in: [types.ts:1090](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1090)
|
|
802
802
|
|
|
803
803
|
Extract publisher names from a contract.
|
|
804
804
|
|
|
@@ -809,7 +809,7 @@ It's used internally for type inference in the TypedAmqpClient.
|
|
|
809
809
|
|
|
810
810
|
| Type Parameter | Description |
|
|
811
811
|
| ------ | ------ |
|
|
812
|
-
| `TContract` *extends* [`
|
|
812
|
+
| `TContract` *extends* [`ContractDefinitionInput`](#contractdefinitioninput) | The contract definition |
|
|
813
813
|
|
|
814
814
|
#### Returns
|
|
815
815
|
|
|
@@ -830,7 +830,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
|
|
|
830
830
|
type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
|
|
831
831
|
```
|
|
832
832
|
|
|
833
|
-
Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/
|
|
833
|
+
Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/routing-types.ts#L114)
|
|
834
834
|
|
|
835
835
|
Validate that a routing key matches a binding pattern.
|
|
836
836
|
|
|
@@ -862,7 +862,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
|
|
|
862
862
|
type MessageDefinition<TPayload, THeaders> = object;
|
|
863
863
|
```
|
|
864
864
|
|
|
865
|
-
Defined in: [types.ts:695](https://github.com/btravers/amqp-contract/blob/
|
|
865
|
+
Defined in: [types.ts:695](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L695)
|
|
866
866
|
|
|
867
867
|
Definition of a message with typed payload and optional headers.
|
|
868
868
|
|
|
@@ -877,10 +877,10 @@ Definition of a message with typed payload and optional headers.
|
|
|
877
877
|
|
|
878
878
|
| Property | Type | Description | Defined in |
|
|
879
879
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L715) |
|
|
884
884
|
|
|
885
885
|
***
|
|
886
886
|
|
|
@@ -899,7 +899,7 @@ type PublisherDefinition<TMessage> = object &
|
|
|
899
899
|
};
|
|
900
900
|
```
|
|
901
901
|
|
|
902
|
-
Defined in: [types.ts:837](https://github.com/btravers/amqp-contract/blob/
|
|
902
|
+
Defined in: [types.ts:837](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L837)
|
|
903
903
|
|
|
904
904
|
Definition of a message publisher.
|
|
905
905
|
|
|
@@ -913,7 +913,7 @@ algorithm when calling the publish method.
|
|
|
913
913
|
|
|
914
914
|
| Name | Type | Description | Defined in |
|
|
915
915
|
| ------ | ------ | ------ | ------ |
|
|
916
|
-
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:839](https://github.com/btravers/amqp-contract/blob/
|
|
916
|
+
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:839](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L839) |
|
|
917
917
|
|
|
918
918
|
#### Type Parameters
|
|
919
919
|
|
|
@@ -941,7 +941,7 @@ type PublisherEntry =
|
|
|
941
941
|
| EventPublisherConfigBase;
|
|
942
942
|
```
|
|
943
943
|
|
|
944
|
-
Defined in: [types.ts:1012](https://github.com/btravers/amqp-contract/blob/
|
|
944
|
+
Defined in: [types.ts:1012](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L1012)
|
|
945
945
|
|
|
946
946
|
Publisher entry that can be passed to defineContract's publishers section.
|
|
947
947
|
|
|
@@ -966,7 +966,7 @@ type QueueBindingDefinition = object &
|
|
|
966
966
|
};
|
|
967
967
|
```
|
|
968
968
|
|
|
969
|
-
Defined in: [types.ts:731](https://github.com/btravers/amqp-contract/blob/
|
|
969
|
+
Defined in: [types.ts:731](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L731)
|
|
970
970
|
|
|
971
971
|
Binding between a queue and an exchange.
|
|
972
972
|
|
|
@@ -978,9 +978,9 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
|
|
|
978
978
|
|
|
979
979
|
| Name | Type | Description | Defined in |
|
|
980
980
|
| ------ | ------ | ------ | ------ |
|
|
981
|
-
| `arguments?` | `Record`<`string`, `unknown`> | 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/
|
|
982
|
-
| `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:736](https://github.com/btravers/amqp-contract/blob/
|
|
983
|
-
| `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:733](https://github.com/btravers/amqp-contract/blob/
|
|
981
|
+
| `arguments?` | `Record`<`string`, `unknown`> | 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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L733) |
|
|
984
984
|
|
|
985
985
|
***
|
|
986
986
|
|
|
@@ -992,7 +992,7 @@ type QueueDefinition =
|
|
|
992
992
|
| ClassicQueueDefinition;
|
|
993
993
|
```
|
|
994
994
|
|
|
995
|
-
Defined in: [types.ts:629](https://github.com/btravers/amqp-contract/blob/
|
|
995
|
+
Defined in: [types.ts:629](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L629)
|
|
996
996
|
|
|
997
997
|
Definition of an AMQP queue.
|
|
998
998
|
|
|
@@ -1012,7 +1012,7 @@ type QueueEntry =
|
|
|
1012
1012
|
| QueueWithTtlBackoffInfrastructure;
|
|
1013
1013
|
```
|
|
1014
1014
|
|
|
1015
|
-
Defined in: [types.ts:687](https://github.com/btravers/amqp-contract/blob/
|
|
1015
|
+
Defined in: [types.ts:687](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L687)
|
|
1016
1016
|
|
|
1017
1017
|
A queue entry that can be passed to `defineContract`.
|
|
1018
1018
|
|
|
@@ -1026,7 +1026,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
|
|
|
1026
1026
|
type QueueType = "quorum" | "classic";
|
|
1027
1027
|
```
|
|
1028
1028
|
|
|
1029
|
-
Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/
|
|
1029
|
+
Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L163)
|
|
1030
1030
|
|
|
1031
1031
|
Supported queue types in RabbitMQ.
|
|
1032
1032
|
|
|
@@ -1065,7 +1065,7 @@ const tempQueue = defineQueue('temp-queue', {
|
|
|
1065
1065
|
type QueueWithTtlBackoffInfrastructure = object;
|
|
1066
1066
|
```
|
|
1067
1067
|
|
|
1068
|
-
Defined in: [types.ts:654](https://github.com/btravers/amqp-contract/blob/
|
|
1068
|
+
Defined in: [types.ts:654](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L654)
|
|
1069
1069
|
|
|
1070
1070
|
A queue with automatically generated TTL-backoff retry infrastructure.
|
|
1071
1071
|
|
|
@@ -1094,10 +1094,10 @@ const contract = defineContract({
|
|
|
1094
1094
|
|
|
1095
1095
|
| Property | Type | Description | Defined in |
|
|
1096
1096
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
1098
|
-
| <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The main queue definition. | [types.ts:664](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L674) |
|
|
1101
1101
|
|
|
1102
1102
|
***
|
|
1103
1103
|
|
|
@@ -1107,7 +1107,7 @@ const contract = defineContract({
|
|
|
1107
1107
|
type QuorumNativeRetryOptions = object;
|
|
1108
1108
|
```
|
|
1109
1109
|
|
|
1110
|
-
Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/
|
|
1110
|
+
Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L72)
|
|
1111
1111
|
|
|
1112
1112
|
Quorum-Native retry options using RabbitMQ's native delivery limit feature.
|
|
1113
1113
|
|
|
@@ -1127,7 +1127,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
1127
1127
|
|
|
1128
1128
|
| Property | Type | Description | Defined in |
|
|
1129
1129
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L77) |
|
|
1131
1131
|
|
|
1132
1132
|
***
|
|
1133
1133
|
|
|
@@ -1137,7 +1137,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
1137
1137
|
type QuorumQueueDefinition = BaseQueueDefinition & object;
|
|
1138
1138
|
```
|
|
1139
1139
|
|
|
1140
|
-
Defined in: [types.ts:542](https://github.com/btravers/amqp-contract/blob/
|
|
1140
|
+
Defined in: [types.ts:542](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L542)
|
|
1141
1141
|
|
|
1142
1142
|
Definition of a quorum queue.
|
|
1143
1143
|
|
|
@@ -1148,11 +1148,11 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
|
|
|
1148
1148
|
|
|
1149
1149
|
| Name | Type | Description | Defined in |
|
|
1150
1150
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
1155
|
-
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:546](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L583) |
|
|
1155
|
+
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:546](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L546) |
|
|
1156
1156
|
|
|
1157
1157
|
***
|
|
1158
1158
|
|
|
@@ -1162,7 +1162,7 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
|
|
|
1162
1162
|
type QuorumQueueOptions = BaseQueueOptions & object;
|
|
1163
1163
|
```
|
|
1164
1164
|
|
|
1165
|
-
Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/
|
|
1165
|
+
Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L214)
|
|
1166
1166
|
|
|
1167
1167
|
Options for creating a quorum queue.
|
|
1168
1168
|
|
|
@@ -1179,11 +1179,11 @@ Quorum queues provide native retry support via `deliveryLimit`:
|
|
|
1179
1179
|
|
|
1180
1180
|
| Name | Type | Description | Defined in |
|
|
1181
1181
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
1186
|
-
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L298) |
|
|
1186
|
+
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L218) |
|
|
1187
1187
|
|
|
1188
1188
|
#### Example
|
|
1189
1189
|
|
|
@@ -1205,7 +1205,7 @@ type ResolvedRetryOptions =
|
|
|
1205
1205
|
| QuorumNativeRetryOptions;
|
|
1206
1206
|
```
|
|
1207
1207
|
|
|
1208
|
-
Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/
|
|
1208
|
+
Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L104)
|
|
1209
1209
|
|
|
1210
1210
|
Resolved retry configuration stored in queue definitions.
|
|
1211
1211
|
|
|
@@ -1221,7 +1221,7 @@ This is a discriminated union based on the `mode` field:
|
|
|
1221
1221
|
type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
|
|
1222
1222
|
```
|
|
1223
1223
|
|
|
1224
|
-
Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/
|
|
1224
|
+
Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/routing-types.ts#L25)
|
|
1225
1225
|
|
|
1226
1226
|
Type-safe routing key that validates basic format.
|
|
1227
1227
|
|
|
@@ -1255,7 +1255,7 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
|
|
|
1255
1255
|
type TopicExchangeDefinition = BaseExchangeDefinition & object;
|
|
1256
1256
|
```
|
|
1257
1257
|
|
|
1258
|
-
Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/
|
|
1258
|
+
Defined in: [types.ts:459](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L459)
|
|
1259
1259
|
|
|
1260
1260
|
A topic exchange definition.
|
|
1261
1261
|
|
|
@@ -1269,7 +1269,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
|
|
|
1269
1269
|
|
|
1270
1270
|
| Name | Type | Defined in |
|
|
1271
1271
|
| ------ | ------ | ------ |
|
|
1272
|
-
| `type` | `"topic"` | [types.ts:460](https://github.com/btravers/amqp-contract/blob/
|
|
1272
|
+
| `type` | `"topic"` | [types.ts:460](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L460) |
|
|
1273
1273
|
|
|
1274
1274
|
#### Example
|
|
1275
1275
|
|
|
@@ -1288,7 +1288,7 @@ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', 'topic'
|
|
|
1288
1288
|
type TtlBackoffRetryInfrastructure = object;
|
|
1289
1289
|
```
|
|
1290
1290
|
|
|
1291
|
-
Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/
|
|
1291
|
+
Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/ttl-backoff.ts#L10)
|
|
1292
1292
|
|
|
1293
1293
|
Result type for TTL-backoff retry infrastructure builder.
|
|
1294
1294
|
|
|
@@ -1298,9 +1298,9 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
|
|
|
1298
1298
|
|
|
1299
1299
|
| Property | Type | Description | Defined in |
|
|
1300
1300
|
| ------ | ------ | ------ | ------ |
|
|
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/
|
|
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/
|
|
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/
|
|
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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/ttl-backoff.ts#L19) |
|
|
1304
1304
|
|
|
1305
1305
|
***
|
|
1306
1306
|
|
|
@@ -1310,7 +1310,7 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
|
|
|
1310
1310
|
type TtlBackoffRetryOptions = object;
|
|
1311
1311
|
```
|
|
1312
1312
|
|
|
1313
|
-
Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/
|
|
1313
|
+
Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L27)
|
|
1314
1314
|
|
|
1315
1315
|
TTL-Backoff retry options for exponential backoff with configurable delays.
|
|
1316
1316
|
|
|
@@ -1324,12 +1324,12 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
|
|
|
1324
1324
|
|
|
1325
1325
|
| Property | Type | Description | Defined in |
|
|
1326
1326
|
| ------ | ------ | ------ | ------ |
|
|
1327
|
-
| <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
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/
|
|
1327
|
+
| <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/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/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/types.ts#L31) |
|
|
1333
1333
|
|
|
1334
1334
|
## Functions
|
|
1335
1335
|
|
|
@@ -1342,7 +1342,7 @@ function defineConsumer<TMessage>(
|
|
|
1342
1342
|
options?): ConsumerDefinition<TMessage>;
|
|
1343
1343
|
```
|
|
1344
1344
|
|
|
1345
|
-
Defined in: [builder/consumer.ts:
|
|
1345
|
+
Defined in: [builder/consumer.ts:121](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/consumer.ts#L121)
|
|
1346
1346
|
|
|
1347
1347
|
Define a message consumer.
|
|
1348
1348
|
|
|
@@ -1427,7 +1427,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
|
|
|
1427
1427
|
function defineContract<TContract>(definition): TContract;
|
|
1428
1428
|
```
|
|
1429
1429
|
|
|
1430
|
-
Defined in: [builder/contract.ts:
|
|
1430
|
+
Defined in: [builder/contract.ts:91](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/contract.ts#L91)
|
|
1431
1431
|
|
|
1432
1432
|
Define an AMQP contract.
|
|
1433
1433
|
|
|
@@ -1516,7 +1516,7 @@ export const contract = defineContract({
|
|
|
1516
1516
|
function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
|
|
1517
1517
|
```
|
|
1518
1518
|
|
|
1519
|
-
Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/
|
|
1519
|
+
Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/message.ts#L39)
|
|
1520
1520
|
|
|
1521
1521
|
Define a message definition with payload and optional headers/metadata.
|
|
1522
1522
|
|
|
@@ -1579,7 +1579,7 @@ function defineQueue(name, options?):
|
|
|
1579
1579
|
| QueueWithTtlBackoffInfrastructure;
|
|
1580
1580
|
```
|
|
1581
1581
|
|
|
1582
|
-
Defined in: [builder/queue.ts:244](https://github.com/btravers/amqp-contract/blob/
|
|
1582
|
+
Defined in: [builder/queue.ts:244](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L244)
|
|
1583
1583
|
|
|
1584
1584
|
Define an AMQP queue.
|
|
1585
1585
|
|
|
@@ -1654,7 +1654,7 @@ const orderQueue = defineQueue('order-processing', {
|
|
|
1654
1654
|
function defineQuorumQueue(name, options): QuorumQueueDefinition;
|
|
1655
1655
|
```
|
|
1656
1656
|
|
|
1657
|
-
Defined in: [builder/queue.ts:442](https://github.com/btravers/amqp-contract/blob/
|
|
1657
|
+
Defined in: [builder/queue.ts:442](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L442)
|
|
1658
1658
|
|
|
1659
1659
|
Create a quorum queue with quorum-native retry.
|
|
1660
1660
|
|
|
@@ -1711,7 +1711,7 @@ const contract = defineContract({
|
|
|
1711
1711
|
function defineTtlBackoffQueue(name, options): QueueWithTtlBackoffInfrastructure;
|
|
1712
1712
|
```
|
|
1713
1713
|
|
|
1714
|
-
Defined in: [builder/queue.ts:580](https://github.com/btravers/amqp-contract/blob/
|
|
1714
|
+
Defined in: [builder/queue.ts:580](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L580)
|
|
1715
1715
|
|
|
1716
1716
|
Create a queue with TTL-backoff retry (exponential backoff).
|
|
1717
1717
|
|
|
@@ -1780,7 +1780,7 @@ const queueName = extractQueue(orderQueue).name;
|
|
|
1780
1780
|
function defineTtlBackoffRetryInfrastructure(queueEntry, options?): TtlBackoffRetryInfrastructure;
|
|
1781
1781
|
```
|
|
1782
1782
|
|
|
1783
|
-
Defined in: [builder/ttl-backoff.ts:76](https://github.com/btravers/amqp-contract/blob/
|
|
1783
|
+
Defined in: [builder/ttl-backoff.ts:76](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/ttl-backoff.ts#L76)
|
|
1784
1784
|
|
|
1785
1785
|
Create TTL-backoff retry infrastructure for a queue.
|
|
1786
1786
|
|
|
@@ -1846,13 +1846,62 @@ const contract = defineContract({
|
|
|
1846
1846
|
|
|
1847
1847
|
***
|
|
1848
1848
|
|
|
1849
|
+
### extractConsumer()
|
|
1850
|
+
|
|
1851
|
+
```ts
|
|
1852
|
+
function extractConsumer(entry): ConsumerDefinition;
|
|
1853
|
+
```
|
|
1854
|
+
|
|
1855
|
+
Defined in: [builder/consumer.ts:55](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/consumer.ts#L55)
|
|
1856
|
+
|
|
1857
|
+
Extract the ConsumerDefinition from any ConsumerEntry type.
|
|
1858
|
+
|
|
1859
|
+
Handles the following entry types:
|
|
1860
|
+
- ConsumerDefinition: returned as-is
|
|
1861
|
+
- EventConsumerResult: returns the nested `.consumer` property
|
|
1862
|
+
- CommandConsumerConfig: returns the nested `.consumer` property
|
|
1863
|
+
|
|
1864
|
+
Use this function when you need to access the underlying ConsumerDefinition
|
|
1865
|
+
from a consumer entry that may have been created with defineEventConsumer
|
|
1866
|
+
or defineCommandConsumer.
|
|
1867
|
+
|
|
1868
|
+
#### Parameters
|
|
1869
|
+
|
|
1870
|
+
| Parameter | Type | Description |
|
|
1871
|
+
| ------ | ------ | ------ |
|
|
1872
|
+
| `entry` | [`ConsumerEntry`](#consumerentry) | The consumer entry to extract from |
|
|
1873
|
+
|
|
1874
|
+
#### Returns
|
|
1875
|
+
|
|
1876
|
+
[`ConsumerDefinition`](#consumerdefinition)
|
|
1877
|
+
|
|
1878
|
+
The underlying ConsumerDefinition
|
|
1879
|
+
|
|
1880
|
+
#### Example
|
|
1881
|
+
|
|
1882
|
+
```typescript
|
|
1883
|
+
// Works with plain ConsumerDefinition
|
|
1884
|
+
const consumer1 = defineConsumer(queue, message);
|
|
1885
|
+
extractConsumer(consumer1).queue.name; // "my-queue"
|
|
1886
|
+
|
|
1887
|
+
// Works with EventConsumerResult
|
|
1888
|
+
const consumer2 = defineEventConsumer(eventPublisher, queue);
|
|
1889
|
+
extractConsumer(consumer2).queue.name; // "my-queue"
|
|
1890
|
+
|
|
1891
|
+
// Works with CommandConsumerConfig
|
|
1892
|
+
const consumer3 = defineCommandConsumer(queue, exchange, message, { routingKey: "cmd" });
|
|
1893
|
+
extractConsumer(consumer3).queue.name; // "my-queue"
|
|
1894
|
+
```
|
|
1895
|
+
|
|
1896
|
+
***
|
|
1897
|
+
|
|
1849
1898
|
### extractQueue()
|
|
1850
1899
|
|
|
1851
1900
|
```ts
|
|
1852
1901
|
function extractQueue(entry): QueueDefinition;
|
|
1853
1902
|
```
|
|
1854
1903
|
|
|
1855
|
-
Defined in: [builder/queue.ts:126](https://github.com/btravers/amqp-contract/blob/
|
|
1904
|
+
Defined in: [builder/queue.ts:126](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L126)
|
|
1856
1905
|
|
|
1857
1906
|
Extract the plain QueueDefinition from a QueueEntry.
|
|
1858
1907
|
|
|
@@ -1921,7 +1970,7 @@ console.log(queueDef.deadLetter); // { exchange: dlx, ... }
|
|
|
1921
1970
|
function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
|
|
1922
1971
|
```
|
|
1923
1972
|
|
|
1924
|
-
Defined in: [builder/command.ts:279](https://github.com/btravers/amqp-contract/blob/
|
|
1973
|
+
Defined in: [builder/command.ts:279](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/command.ts#L279)
|
|
1925
1974
|
|
|
1926
1975
|
Type guard to check if a value is a CommandConsumerConfig.
|
|
1927
1976
|
|
|
@@ -1945,7 +1994,7 @@ True if the value is a CommandConsumerConfig
|
|
|
1945
1994
|
function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition>;
|
|
1946
1995
|
```
|
|
1947
1996
|
|
|
1948
|
-
Defined in: [builder/event.ts:338](https://github.com/btravers/amqp-contract/blob/
|
|
1997
|
+
Defined in: [builder/event.ts:338](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L338)
|
|
1949
1998
|
|
|
1950
1999
|
Type guard to check if a value is an EventConsumerResult.
|
|
1951
2000
|
|
|
@@ -1969,7 +2018,7 @@ True if the value is an EventConsumerResult
|
|
|
1969
2018
|
function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
|
|
1970
2019
|
```
|
|
1971
2020
|
|
|
1972
|
-
Defined in: [builder/event.ts:321](https://github.com/btravers/amqp-contract/blob/
|
|
2021
|
+
Defined in: [builder/event.ts:321](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/event.ts#L321)
|
|
1973
2022
|
|
|
1974
2023
|
Type guard to check if a value is an EventPublisherConfig.
|
|
1975
2024
|
|
|
@@ -1993,7 +2042,7 @@ True if the value is an EventPublisherConfig
|
|
|
1993
2042
|
function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
|
|
1994
2043
|
```
|
|
1995
2044
|
|
|
1996
|
-
Defined in: [builder/queue.ts:67](https://github.com/btravers/amqp-contract/blob/
|
|
2045
|
+
Defined in: [builder/queue.ts:67](https://github.com/btravers/amqp-contract/blob/d132d062ebeaa9cc84db5471805355a29e3a50dc/packages/contract/src/builder/queue.ts#L67)
|
|
1997
2046
|
|
|
1998
2047
|
Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
|
|
1999
2048
|
|