@amqp-contract/contract 0.16.0 → 0.18.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/dist/index.cjs +71 -20
- package/dist/index.d.cts +187 -23
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +187 -23
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +71 -21
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +277 -186
- package/package.json +2 -2
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/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L12)
|
|
16
16
|
|
|
17
17
|
Any schema that conforms to Standard Schema v1.
|
|
18
18
|
|
|
@@ -32,7 +32,7 @@ https://github.com/standard-schema/standard-schema
|
|
|
32
32
|
type BaseExchangeDefinition<TName> = object;
|
|
33
33
|
```
|
|
34
34
|
|
|
35
|
-
Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/
|
|
35
|
+
Defined in: [types.ts:376](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L376)
|
|
36
36
|
|
|
37
37
|
Base definition of an AMQP exchange.
|
|
38
38
|
|
|
@@ -49,11 +49,11 @@ type and routing rules. This type contains properties common to all exchange typ
|
|
|
49
49
|
|
|
50
50
|
| Property | Type | Description | Defined in |
|
|
51
51
|
| ------ | ------ | ------ | ------ |
|
|
52
|
-
| <a id="arguments"></a> `arguments?` | `Record`<`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/
|
|
53
|
-
| <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:392](https://github.com/btravers/amqp-contract/blob/
|
|
54
|
-
| <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:386](https://github.com/btravers/amqp-contract/blob/
|
|
55
|
-
| <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. **Default** `false` | [types.ts:399](https://github.com/btravers/amqp-contract/blob/
|
|
56
|
-
| <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/
|
|
52
|
+
| <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/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L405) |
|
|
53
|
+
| <a id="autodelete"></a> `autoDelete?` | `boolean` | If true, the exchange is deleted when all queues have finished using it. **Default** `false` | [types.ts:392](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L392) |
|
|
54
|
+
| <a id="durable"></a> `durable?` | `boolean` | If true, the exchange survives broker restarts. Durable exchanges are persisted to disk. **Default** `false` | [types.ts:386](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L386) |
|
|
55
|
+
| <a id="internal"></a> `internal?` | `boolean` | If true, the exchange cannot be directly published to by clients. It can only receive messages from other exchanges via exchange-to-exchange bindings. **Default** `false` | [types.ts:399](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L399) |
|
|
56
|
+
| <a id="name"></a> `name` | `TName` | The name of the exchange. Must be unique within the RabbitMQ virtual host. | [types.ts:380](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L380) |
|
|
57
57
|
|
|
58
58
|
***
|
|
59
59
|
|
|
@@ -65,7 +65,7 @@ type BindingDefinition =
|
|
|
65
65
|
| ExchangeBindingDefinition;
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
-
Defined in: [types.ts:831](https://github.com/btravers/amqp-contract/blob/
|
|
68
|
+
Defined in: [types.ts:831](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L831)
|
|
69
69
|
|
|
70
70
|
Union type of all binding definitions.
|
|
71
71
|
|
|
@@ -81,7 +81,7 @@ A binding can be either:
|
|
|
81
81
|
type BindingPattern<S> = S extends "" ? never : S;
|
|
82
82
|
```
|
|
83
83
|
|
|
84
|
-
Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/
|
|
84
|
+
Defined in: [builder/routing-types.ts:52](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/routing-types.ts#L52)
|
|
85
85
|
|
|
86
86
|
Type-safe binding pattern that validates basic format and wildcards.
|
|
87
87
|
|
|
@@ -110,13 +110,75 @@ type Invalid = BindingPattern<"">; // never (empty string)
|
|
|
110
110
|
|
|
111
111
|
***
|
|
112
112
|
|
|
113
|
+
### BridgedPublisherConfig
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
type BridgedPublisherConfig<TMessage, TBridgeExchange, TTargetExchange> = object;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Defined in: [builder/command.ts:66](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L66)
|
|
120
|
+
|
|
121
|
+
Configuration for a bridged command publisher.
|
|
122
|
+
|
|
123
|
+
A bridged publisher publishes to a bridge exchange (local domain), which forwards
|
|
124
|
+
messages to the target exchange (remote domain) via an exchange-to-exchange binding.
|
|
125
|
+
|
|
126
|
+
#### Type Parameters
|
|
127
|
+
|
|
128
|
+
| Type Parameter | Description |
|
|
129
|
+
| ------ | ------ |
|
|
130
|
+
| `TMessage` *extends* [`MessageDefinition`](#messagedefinition) | The message definition |
|
|
131
|
+
| `TBridgeExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | The bridge (local domain) exchange definition |
|
|
132
|
+
| `TTargetExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | The target (remote domain) exchange definition |
|
|
133
|
+
|
|
134
|
+
#### Properties
|
|
135
|
+
|
|
136
|
+
| Property | Type | Description | Defined in |
|
|
137
|
+
| ------ | ------ | ------ | ------ |
|
|
138
|
+
| <a id="__brand"></a> `__brand` | `"BridgedPublisherConfig"` | Discriminator to identify this as a bridged publisher config | [builder/command.ts:72](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L72) |
|
|
139
|
+
| <a id="bridgeexchange"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange | [builder/command.ts:78](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L78) |
|
|
140
|
+
| <a id="exchangebinding"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | The exchange-to-exchange binding (bridge → target) | [builder/command.ts:76](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L76) |
|
|
141
|
+
| <a id="publisher"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition)<`TMessage`> | The publisher definition (publishes to bridge exchange) | [builder/command.ts:74](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L74) |
|
|
142
|
+
| <a id="targetexchange"></a> `targetExchange` | `TTargetExchange` | The target (remote domain) exchange | [builder/command.ts:80](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L80) |
|
|
143
|
+
|
|
144
|
+
***
|
|
145
|
+
|
|
146
|
+
### BridgedPublisherConfigBase
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
type BridgedPublisherConfigBase = object;
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Defined in: [types.ts:966](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L966)
|
|
153
|
+
|
|
154
|
+
Base type for bridged publisher configuration.
|
|
155
|
+
|
|
156
|
+
A bridged publisher publishes to a bridge exchange, which forwards messages
|
|
157
|
+
to the target exchange via an exchange-to-exchange binding.
|
|
158
|
+
|
|
159
|
+
#### See
|
|
160
|
+
|
|
161
|
+
defineCommandPublisher with bridgeExchange option
|
|
162
|
+
|
|
163
|
+
#### Properties
|
|
164
|
+
|
|
165
|
+
| Property | Type | Defined in |
|
|
166
|
+
| ------ | ------ | ------ |
|
|
167
|
+
| <a id="__brand-1"></a> `__brand` | `"BridgedPublisherConfig"` | [types.ts:967](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L967) |
|
|
168
|
+
| <a id="bridgeexchange-1"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:970](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L970) |
|
|
169
|
+
| <a id="exchangebinding-1"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) | [types.ts:969](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L969) |
|
|
170
|
+
| <a id="publisher-1"></a> `publisher` | [`PublisherDefinition`](#publisherdefinition) | [types.ts:968](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L968) |
|
|
171
|
+
| <a id="targetexchange-1"></a> `targetExchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:971](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L971) |
|
|
172
|
+
|
|
173
|
+
***
|
|
174
|
+
|
|
113
175
|
### ClassicQueueDefinition
|
|
114
176
|
|
|
115
177
|
```ts
|
|
116
178
|
type ClassicQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
|
|
117
179
|
```
|
|
118
180
|
|
|
119
|
-
Defined in: [types.ts:595](https://github.com/btravers/amqp-contract/blob/
|
|
181
|
+
Defined in: [types.ts:595](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L595)
|
|
120
182
|
|
|
121
183
|
Definition of a classic queue.
|
|
122
184
|
|
|
@@ -127,10 +189,10 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
|
|
|
127
189
|
|
|
128
190
|
| Name | Type | Description | Defined in |
|
|
129
191
|
| ------ | ------ | ------ | ------ |
|
|
130
|
-
| `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:605](https://github.com/btravers/amqp-contract/blob/
|
|
131
|
-
| `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:612](https://github.com/btravers/amqp-contract/blob/
|
|
132
|
-
| `retry` | `ResolvedTtlBackoffRetryOptions` | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode (default). When the queue is created, defaults are applied. | [types.ts:620](https://github.com/btravers/amqp-contract/blob/
|
|
133
|
-
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:599](https://github.com/btravers/amqp-contract/blob/
|
|
192
|
+
| `deliveryLimit?` | `never` | Classic queues do not support delivery limits. Use type: 'quorum' if you need native retry with delivery limits. | [types.ts:605](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L605) |
|
|
193
|
+
| `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:612](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L612) |
|
|
194
|
+
| `retry` | `ResolvedTtlBackoffRetryOptions` | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode (default). When the queue is created, defaults are applied. | [types.ts:620](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L620) |
|
|
195
|
+
| `type` | `"classic"` | Queue type discriminator: classic queue. | [types.ts:599](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L599) |
|
|
134
196
|
|
|
135
197
|
#### Type Parameters
|
|
136
198
|
|
|
@@ -146,7 +208,7 @@ specific features not supported by quorum queues (e.g., exclusive queues, priori
|
|
|
146
208
|
type ClassicQueueOptions = BaseQueueOptions & object;
|
|
147
209
|
```
|
|
148
210
|
|
|
149
|
-
Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/
|
|
211
|
+
Defined in: [types.ts:318](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L318)
|
|
150
212
|
|
|
151
213
|
Options for creating a classic queue.
|
|
152
214
|
|
|
@@ -159,10 +221,10 @@ Classic queues support all traditional RabbitMQ features including:
|
|
|
159
221
|
|
|
160
222
|
| Name | Type | Description | Defined in |
|
|
161
223
|
| ------ | ------ | ------ | ------ |
|
|
162
|
-
| `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/
|
|
163
|
-
| `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/
|
|
164
|
-
| `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/
|
|
165
|
-
| `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/
|
|
224
|
+
| `exclusive?` | `boolean` | If true, the queue can only be used by the declaring connection and is deleted when that connection closes. Exclusive queues are private to the connection. **Default** `false` | [types.ts:329](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L329) |
|
|
225
|
+
| `maxPriority?` | `number` | Maximum priority level for priority queue (1-255, recommended: 1-10). Sets x-max-priority argument. Only supported with classic queues. | [types.ts:336](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L336) |
|
|
226
|
+
| `retry?` | [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) | Retry configuration for handling failed message processing. Classic queues only support TTL-backoff retry mode, which uses wait queues with exponential backoff. For quorum-native retry, use quorum queues instead. **Example** `const orderQueue = defineQueue('order-processing', { type: 'classic', durable: true, deadLetter: { exchange: dlx }, retry: { maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, });` | [types.ts:358](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L358) |
|
|
227
|
+
| `type` | `"classic"` | Queue type: classic (for special cases) | [types.ts:322](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L322) |
|
|
166
228
|
|
|
167
229
|
#### Example
|
|
168
230
|
|
|
@@ -182,7 +244,7 @@ const priorityQueue = defineQueue('tasks', {
|
|
|
182
244
|
type CommandConsumerConfig<TMessage, TExchange, TRoutingKey, TQueue, TDlxExchange> = object;
|
|
183
245
|
```
|
|
184
246
|
|
|
185
|
-
Defined in: [builder/command.ts:
|
|
247
|
+
Defined in: [builder/command.ts:31](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L31)
|
|
186
248
|
|
|
187
249
|
Configuration for a command consumer.
|
|
188
250
|
|
|
@@ -203,14 +265,14 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
203
265
|
|
|
204
266
|
| Property | Type | Description | Defined in |
|
|
205
267
|
| ------ | ------ | ------ | ------ |
|
|
206
|
-
| <a id="__brand"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:
|
|
207
|
-
| <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:
|
|
208
|
-
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:
|
|
209
|
-
| <a id="deadletterexchange"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/command.ts:
|
|
210
|
-
| <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:
|
|
211
|
-
| <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:
|
|
212
|
-
| <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:
|
|
213
|
-
| <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:
|
|
268
|
+
| <a id="__brand-2"></a> `__brand` | `"CommandConsumerConfig"` | Discriminator to identify this as a command consumer config | [builder/command.ts:39](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L39) |
|
|
269
|
+
| <a id="binding"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/command.ts:43](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L43) |
|
|
270
|
+
| <a id="consumer"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing commands | [builder/command.ts:41](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L41) |
|
|
271
|
+
| <a id="deadletterexchange"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/command.ts:49](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L49) |
|
|
272
|
+
| <a id="exchange"></a> `exchange` | `TExchange` | The exchange that receives commands | [builder/command.ts:45](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L45) |
|
|
273
|
+
| <a id="message"></a> `message` | `TMessage` | The message definition | [builder/command.ts:51](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L51) |
|
|
274
|
+
| <a id="queue"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/command.ts:47](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L47) |
|
|
275
|
+
| <a id="routingkey"></a> `routingKey` | `TRoutingKey` | The routing key pattern for the binding | [builder/command.ts:53](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L53) |
|
|
214
276
|
|
|
215
277
|
***
|
|
216
278
|
|
|
@@ -220,7 +282,7 @@ The consumer "owns" the queue, and publishers send commands to it.
|
|
|
220
282
|
type CommandConsumerConfigBase = object;
|
|
221
283
|
```
|
|
222
284
|
|
|
223
|
-
Defined in: [types.ts:928](https://github.com/btravers/amqp-contract/blob/
|
|
285
|
+
Defined in: [types.ts:928](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L928)
|
|
224
286
|
|
|
225
287
|
Base type for command consumer configuration.
|
|
226
288
|
|
|
@@ -235,14 +297,14 @@ defineCommandConsumer for creating command consumers
|
|
|
235
297
|
|
|
236
298
|
| Property | Type | Defined in |
|
|
237
299
|
| ------ | ------ | ------ |
|
|
238
|
-
| <a id="__brand-
|
|
239
|
-
| <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/
|
|
240
|
-
| <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:930](https://github.com/btravers/amqp-contract/blob/
|
|
241
|
-
| <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:934](https://github.com/btravers/amqp-contract/blob/
|
|
242
|
-
| <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/
|
|
243
|
-
| <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:935](https://github.com/btravers/amqp-contract/blob/
|
|
244
|
-
| <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:933](https://github.com/btravers/amqp-contract/blob/
|
|
245
|
-
| <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:936](https://github.com/btravers/amqp-contract/blob/
|
|
300
|
+
| <a id="__brand-3"></a> `__brand` | `"CommandConsumerConfig"` | [types.ts:929](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L929) |
|
|
301
|
+
| <a id="binding-1"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:931](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L931) |
|
|
302
|
+
| <a id="consumer-1"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:930](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L930) |
|
|
303
|
+
| <a id="deadletterexchange-1"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:934](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L934) |
|
|
304
|
+
| <a id="exchange-1"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:932](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L932) |
|
|
305
|
+
| <a id="message-1"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:935](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L935) |
|
|
306
|
+
| <a id="queue-1"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:933](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L933) |
|
|
307
|
+
| <a id="routingkey-1"></a> `routingKey` | `string` \| `undefined` | [types.ts:936](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L936) |
|
|
246
308
|
|
|
247
309
|
***
|
|
248
310
|
|
|
@@ -252,7 +314,7 @@ defineCommandConsumer for creating command consumers
|
|
|
252
314
|
type CompressionAlgorithm = "gzip" | "deflate";
|
|
253
315
|
```
|
|
254
316
|
|
|
255
|
-
Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/
|
|
317
|
+
Defined in: [types.ts:134](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L134)
|
|
256
318
|
|
|
257
319
|
Supported compression algorithms for message payloads.
|
|
258
320
|
|
|
@@ -290,7 +352,7 @@ await client.publish("orderCreated", payload, {
|
|
|
290
352
|
type ConsumerDefinition<TMessage> = object;
|
|
291
353
|
```
|
|
292
354
|
|
|
293
|
-
Defined in: [types.ts:892](https://github.com/btravers/amqp-contract/blob/
|
|
355
|
+
Defined in: [types.ts:892](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L892)
|
|
294
356
|
|
|
295
357
|
Definition of a message consumer.
|
|
296
358
|
|
|
@@ -318,8 +380,8 @@ const consumer: ConsumerDefinition = {
|
|
|
318
380
|
|
|
319
381
|
| Property | Type | Description | Defined in |
|
|
320
382
|
| ------ | ------ | ------ | ------ |
|
|
321
|
-
| <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:897](https://github.com/btravers/amqp-contract/blob/
|
|
322
|
-
| <a id="queue-2"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:894](https://github.com/btravers/amqp-contract/blob/
|
|
383
|
+
| <a id="message-2"></a> `message` | `TMessage` | The message definition including the payload schema | [types.ts:897](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L897) |
|
|
384
|
+
| <a id="queue-2"></a> `queue` | [`QueueDefinition`](#queuedefinition) | The queue to consume messages from | [types.ts:894](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L894) |
|
|
323
385
|
|
|
324
386
|
***
|
|
325
387
|
|
|
@@ -332,7 +394,7 @@ type ConsumerEntry =
|
|
|
332
394
|
| CommandConsumerConfigBase;
|
|
333
395
|
```
|
|
334
396
|
|
|
335
|
-
Defined in: [types.ts:
|
|
397
|
+
Defined in: [types.ts:1064](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1064)
|
|
336
398
|
|
|
337
399
|
Consumer entry that can be passed to defineContract's consumers section.
|
|
338
400
|
|
|
@@ -349,7 +411,7 @@ Can be either:
|
|
|
349
411
|
type ContractDefinition = object;
|
|
350
412
|
```
|
|
351
413
|
|
|
352
|
-
Defined in: [types.ts:
|
|
414
|
+
Defined in: [types.ts:1007](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1007)
|
|
353
415
|
|
|
354
416
|
Complete AMQP contract definition (output type).
|
|
355
417
|
|
|
@@ -388,11 +450,11 @@ const contract: ContractDefinition = {
|
|
|
388
450
|
|
|
389
451
|
| Property | Type | Description | Defined in |
|
|
390
452
|
| ------ | ------ | ------ | ------ |
|
|
391
|
-
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:
|
|
392
|
-
| <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:
|
|
393
|
-
| <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:
|
|
394
|
-
| <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:
|
|
395
|
-
| <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:
|
|
453
|
+
| <a id="bindings"></a> `bindings?` | `Record`<`string`, [`BindingDefinition`](#bindingdefinition)> | Named binding definitions. Bindings can be queue-to-exchange or exchange-to-exchange. | [types.ts:1027](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1027) |
|
|
454
|
+
| <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:1041](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1041) |
|
|
455
|
+
| <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:1012](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1012) |
|
|
456
|
+
| <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:1034](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1034) |
|
|
457
|
+
| <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:1021](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1021) |
|
|
396
458
|
|
|
397
459
|
***
|
|
398
460
|
|
|
@@ -402,7 +464,7 @@ const contract: ContractDefinition = {
|
|
|
402
464
|
type ContractDefinitionInput = object;
|
|
403
465
|
```
|
|
404
466
|
|
|
405
|
-
Defined in: [types.ts:
|
|
467
|
+
Defined in: [types.ts:1093](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1093)
|
|
406
468
|
|
|
407
469
|
Contract definition input type with automatic extraction of event/command patterns.
|
|
408
470
|
|
|
@@ -434,8 +496,8 @@ defineContract - Processes this input and returns a ContractDefinition
|
|
|
434
496
|
|
|
435
497
|
| Property | Type | Description | Defined in |
|
|
436
498
|
| ------ | ------ | ------ | ------ |
|
|
437
|
-
| <a id="consumers-1"></a> `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:
|
|
438
|
-
| <a id="publishers-1"></a> `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:
|
|
499
|
+
| <a id="consumers-1"></a> `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:1111](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1111) |
|
|
500
|
+
| <a id="publishers-1"></a> `publishers?` | `Record`<`string`, [`PublisherEntry`](#publisherentry)> | Named publisher definitions. Can accept: - PublisherDefinition from definePublisher - EventPublisherConfig from defineEventPublisher (auto-extracted to publisher) | [types.ts:1101](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1101) |
|
|
439
501
|
|
|
440
502
|
***
|
|
441
503
|
|
|
@@ -445,7 +507,7 @@ defineContract - Processes this input and returns a ContractDefinition
|
|
|
445
507
|
type ContractOutput<TContract> = object;
|
|
446
508
|
```
|
|
447
509
|
|
|
448
|
-
Defined in: [types.ts:
|
|
510
|
+
Defined in: [types.ts:1420](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1420)
|
|
449
511
|
|
|
450
512
|
Contract output type with all resources extracted and properly typed.
|
|
451
513
|
|
|
@@ -466,11 +528,11 @@ This type represents the fully expanded contract with:
|
|
|
466
528
|
|
|
467
529
|
| Property | Type | Defined in |
|
|
468
530
|
| ------ | ------ | ------ |
|
|
469
|
-
| <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:
|
|
470
|
-
| <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractConsumerDefinitions`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:
|
|
471
|
-
| <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractDeadLetterExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:
|
|
472
|
-
| <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractPublisherDefinitions`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:
|
|
473
|
-
| <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractQueuesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:
|
|
531
|
+
| <a id="bindings-1"></a> `bindings` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangeBindingsFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangeBindingsFromPublishers`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:1439](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1439) |
|
|
532
|
+
| <a id="consumers-2"></a> `consumers` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractConsumerDefinitions`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:1451](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1451) |
|
|
533
|
+
| <a id="exchanges-1"></a> `exchanges` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractDeadLetterExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractBridgeExchangesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` & `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractTargetExchangesFromPublishers`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:1421](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1421) |
|
|
534
|
+
| <a id="publishers-2"></a> `publishers` | `TContract`\[`"publishers"`\] *extends* `Record`<`string`, [`PublisherEntry`](#publisherentry)> ? `ExtractPublisherDefinitions`<`TContract`\[`"publishers"`\]> : `object` | [types.ts:1448](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1448) |
|
|
535
|
+
| <a id="queues-1"></a> `queues` | `TContract`\[`"consumers"`\] *extends* `Record`<`string`, [`ConsumerEntry`](#consumerentry)> ? `ExtractQueuesFromConsumers`<`TContract`\[`"consumers"`\]> : `object` | [types.ts:1436](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1436) |
|
|
474
536
|
|
|
475
537
|
***
|
|
476
538
|
|
|
@@ -480,7 +542,7 @@ This type represents the fully expanded contract with:
|
|
|
480
542
|
type DeadLetterConfig = object;
|
|
481
543
|
```
|
|
482
544
|
|
|
483
|
-
Defined in: [types.ts:483](https://github.com/btravers/amqp-contract/blob/
|
|
545
|
+
Defined in: [types.ts:483](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L483)
|
|
484
546
|
|
|
485
547
|
Configuration for dead letter exchange (DLX) on a queue.
|
|
486
548
|
|
|
@@ -492,8 +554,8 @@ or storage.
|
|
|
492
554
|
|
|
493
555
|
| Property | Type | Description | Defined in |
|
|
494
556
|
| ------ | ------ | ------ | ------ |
|
|
495
|
-
| <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:488](https://github.com/btravers/amqp-contract/blob/
|
|
496
|
-
| <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:494](https://github.com/btravers/amqp-contract/blob/
|
|
557
|
+
| <a id="exchange-2"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | The exchange to send dead-lettered messages to. This exchange must be declared in the contract. | [types.ts:488](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L488) |
|
|
558
|
+
| <a id="routingkey-2"></a> `routingKey?` | `string` | Optional routing key to use when forwarding messages to the dead letter exchange. If not specified, the original message routing key is used. | [types.ts:494](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L494) |
|
|
497
559
|
|
|
498
560
|
***
|
|
499
561
|
|
|
@@ -505,7 +567,7 @@ type DefineQueueOptions =
|
|
|
505
567
|
| ClassicQueueOptions;
|
|
506
568
|
```
|
|
507
569
|
|
|
508
|
-
Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/
|
|
570
|
+
Defined in: [types.ts:368](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L368)
|
|
509
571
|
|
|
510
572
|
Options for defining a queue. Uses a discriminated union based on the `type` property
|
|
511
573
|
to enforce quorum queue constraints at compile time.
|
|
@@ -521,7 +583,7 @@ to enforce quorum queue constraints at compile time.
|
|
|
521
583
|
type DefineQuorumQueueOptions = object;
|
|
522
584
|
```
|
|
523
585
|
|
|
524
|
-
Defined in: [builder/queue.ts:390](https://github.com/btravers/amqp-contract/blob/
|
|
586
|
+
Defined in: [builder/queue.ts:390](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L390)
|
|
525
587
|
|
|
526
588
|
Options for creating a quorum queue with quorum-native retry.
|
|
527
589
|
|
|
@@ -533,11 +595,10 @@ This simplified helper enforces the required configuration for quorum-native ret
|
|
|
533
595
|
|
|
534
596
|
| Property | Type | Description | Defined in |
|
|
535
597
|
| ------ | ------ | ------ | ------ |
|
|
536
|
-
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:
|
|
537
|
-
| <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:
|
|
538
|
-
| <a id="
|
|
539
|
-
| <a id="
|
|
540
|
-
| <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:406](https://github.com/btravers/amqp-contract/blob/14b3465c61d25678b908341226a86fc481470ac6/packages/contract/src/builder/queue.ts#L406) |
|
|
598
|
+
| <a id="arguments-1"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:412](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L412) |
|
|
599
|
+
| <a id="autodelete-1"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:407](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L407) |
|
|
600
|
+
| <a id="deadletter"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration - required for retry support. Failed messages will be sent to this exchange. | [builder/queue.ts:395](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L395) |
|
|
601
|
+
| <a id="deliverylimit"></a> `deliveryLimit` | `number` | Maximum number of delivery attempts before dead-lettering. **Minimum** 1 | [builder/queue.ts:401](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L401) |
|
|
541
602
|
|
|
542
603
|
***
|
|
543
604
|
|
|
@@ -547,7 +608,7 @@ This simplified helper enforces the required configuration for quorum-native ret
|
|
|
547
608
|
type DefineTtlBackoffQueueOptions = object;
|
|
548
609
|
```
|
|
549
610
|
|
|
550
|
-
Defined in: [builder/queue.ts:
|
|
611
|
+
Defined in: [builder/queue.ts:477](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L477)
|
|
551
612
|
|
|
552
613
|
Options for creating a queue with TTL-backoff retry.
|
|
553
614
|
|
|
@@ -559,15 +620,14 @@ This simplified helper enforces the required configuration for TTL-backoff retry
|
|
|
559
620
|
|
|
560
621
|
| Property | Type | Description | Defined in |
|
|
561
622
|
| ------ | ------ | ------ | ------ |
|
|
562
|
-
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:
|
|
563
|
-
| <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:
|
|
564
|
-
| <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:
|
|
565
|
-
| <a id="
|
|
566
|
-
| <a id="
|
|
567
|
-
| <a id="
|
|
568
|
-
| <a id="
|
|
569
|
-
| <a id="
|
|
570
|
-
| <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:508](https://github.com/btravers/amqp-contract/blob/14b3465c61d25678b908341226a86fc481470ac6/packages/contract/src/builder/queue.ts#L508) |
|
|
623
|
+
| <a id="arguments-2"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for advanced configuration. | [builder/queue.ts:523](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L523) |
|
|
624
|
+
| <a id="autodelete-2"></a> `autoDelete?` | `boolean` | If true, the queue is deleted when the last consumer unsubscribes. **Default** `false` | [builder/queue.ts:518](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L518) |
|
|
625
|
+
| <a id="backoffmultiplier"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [builder/queue.ts:506](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L506) |
|
|
626
|
+
| <a id="deadletter-1"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration - required for TTL-backoff retry. Used for routing messages to the wait queue and back. | [builder/queue.ts:482](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L482) |
|
|
627
|
+
| <a id="initialdelayms"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [builder/queue.ts:494](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L494) |
|
|
628
|
+
| <a id="jitter"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [builder/queue.ts:512](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L512) |
|
|
629
|
+
| <a id="maxdelayms"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [builder/queue.ts:500](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L500) |
|
|
630
|
+
| <a id="maxretries"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [builder/queue.ts:488](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L488) |
|
|
571
631
|
|
|
572
632
|
***
|
|
573
633
|
|
|
@@ -577,7 +637,7 @@ This simplified helper enforces the required configuration for TTL-backoff retry
|
|
|
577
637
|
type DirectExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
578
638
|
```
|
|
579
639
|
|
|
580
|
-
Defined in: [types.ts:439](https://github.com/btravers/amqp-contract/blob/
|
|
640
|
+
Defined in: [types.ts:439](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L439)
|
|
581
641
|
|
|
582
642
|
A direct exchange definition.
|
|
583
643
|
|
|
@@ -588,7 +648,7 @@ This is ideal for point-to-point messaging where each message should go to speci
|
|
|
588
648
|
|
|
589
649
|
| Name | Type | Defined in |
|
|
590
650
|
| ------ | ------ | ------ |
|
|
591
|
-
| `type` | `"direct"` | [types.ts:441](https://github.com/btravers/amqp-contract/blob/
|
|
651
|
+
| `type` | `"direct"` | [types.ts:441](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L441) |
|
|
592
652
|
|
|
593
653
|
#### Type Parameters
|
|
594
654
|
|
|
@@ -609,10 +669,10 @@ const tasksExchange: DirectExchangeDefinition = defineExchange('tasks', 'direct'
|
|
|
609
669
|
### EventConsumerResult
|
|
610
670
|
|
|
611
671
|
```ts
|
|
612
|
-
type EventConsumerResult<TMessage, TExchange, TQueue, TDlxExchange> = object;
|
|
672
|
+
type EventConsumerResult<TMessage, TExchange, TQueue, TDlxExchange, TExchangeBinding, TBridgeExchange> = object;
|
|
613
673
|
```
|
|
614
674
|
|
|
615
|
-
Defined in: [builder/event.ts:
|
|
675
|
+
Defined in: [builder/event.ts:56](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L56)
|
|
616
676
|
|
|
617
677
|
Result from defineEventConsumer.
|
|
618
678
|
|
|
@@ -628,17 +688,21 @@ will be automatically extracted.
|
|
|
628
688
|
| `TExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) | [`ExchangeDefinition`](#exchangedefinition) | - |
|
|
629
689
|
| `TQueue` *extends* [`QueueDefinition`](#queuedefinition) | [`QueueDefinition`](#queuedefinition) | - |
|
|
630
690
|
| `TDlxExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
|
|
691
|
+
| `TExchangeBinding` *extends* [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | - |
|
|
692
|
+
| `TBridgeExchange` *extends* [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | - |
|
|
631
693
|
|
|
632
694
|
#### Properties
|
|
633
695
|
|
|
634
696
|
| Property | Type | Description | Defined in |
|
|
635
697
|
| ------ | ------ | ------ | ------ |
|
|
636
|
-
| <a id="__brand-
|
|
637
|
-
| <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:
|
|
638
|
-
| <a id="
|
|
639
|
-
| <a id="
|
|
640
|
-
| <a id="
|
|
641
|
-
| <a id="
|
|
698
|
+
| <a id="__brand-4"></a> `__brand` | `"EventConsumerResult"` | Discriminator to identify this as an event consumer result | [builder/event.ts:67](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L67) |
|
|
699
|
+
| <a id="binding-2"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | The binding connecting the queue to the exchange | [builder/event.ts:71](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L71) |
|
|
700
|
+
| <a id="bridgeexchange-2"></a> `bridgeExchange` | `TBridgeExchange` | The bridge (local domain) exchange when bridging, if configured | [builder/event.ts:81](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L81) |
|
|
701
|
+
| <a id="consumer-2"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition)<`TMessage`> | The consumer definition for processing messages | [builder/event.ts:69](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L69) |
|
|
702
|
+
| <a id="deadletterexchange-2"></a> `deadLetterExchange` | `TDlxExchange` | The dead letter exchange from the queue, if configured | [builder/event.ts:77](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L77) |
|
|
703
|
+
| <a id="exchange-3"></a> `exchange` | `TExchange` | The source exchange this consumer subscribes to | [builder/event.ts:73](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L73) |
|
|
704
|
+
| <a id="exchangebinding-2"></a> `exchangeBinding` | `TExchangeBinding` | The exchange-to-exchange binding when bridging, if configured | [builder/event.ts:79](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L79) |
|
|
705
|
+
| <a id="queue-3"></a> `queue` | `TQueue` | The queue this consumer reads from | [builder/event.ts:75](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L75) |
|
|
642
706
|
|
|
643
707
|
***
|
|
644
708
|
|
|
@@ -648,7 +712,7 @@ will be automatically extracted.
|
|
|
648
712
|
type EventConsumerResultBase = object;
|
|
649
713
|
```
|
|
650
714
|
|
|
651
|
-
Defined in: [types.ts:947](https://github.com/btravers/amqp-contract/blob/
|
|
715
|
+
Defined in: [types.ts:947](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L947)
|
|
652
716
|
|
|
653
717
|
Base type for event consumer result.
|
|
654
718
|
|
|
@@ -663,12 +727,14 @@ defineEventConsumer for creating event consumers
|
|
|
663
727
|
|
|
664
728
|
| Property | Type | Defined in |
|
|
665
729
|
| ------ | ------ | ------ |
|
|
666
|
-
| <a id="__brand-
|
|
667
|
-
| <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:950](https://github.com/btravers/amqp-contract/blob/
|
|
668
|
-
| <a id="
|
|
669
|
-
| <a id="
|
|
670
|
-
| <a id="
|
|
671
|
-
| <a id="
|
|
730
|
+
| <a id="__brand-5"></a> `__brand` | `"EventConsumerResult"` | [types.ts:948](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L948) |
|
|
731
|
+
| <a id="binding-3"></a> `binding` | [`QueueBindingDefinition`](#queuebindingdefinition) | [types.ts:950](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L950) |
|
|
732
|
+
| <a id="bridgeexchange-3"></a> `bridgeExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:955](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L955) |
|
|
733
|
+
| <a id="consumer-3"></a> `consumer` | [`ConsumerDefinition`](#consumerdefinition) | [types.ts:949](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L949) |
|
|
734
|
+
| <a id="deadletterexchange-3"></a> `deadLetterExchange` | [`ExchangeDefinition`](#exchangedefinition) \| `undefined` | [types.ts:953](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L953) |
|
|
735
|
+
| <a id="exchange-4"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:951](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L951) |
|
|
736
|
+
| <a id="exchangebinding-3"></a> `exchangeBinding` | [`ExchangeBindingDefinition`](#exchangebindingdefinition) \| `undefined` | [types.ts:954](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L954) |
|
|
737
|
+
| <a id="queue-4"></a> `queue` | [`QueueDefinition`](#queuedefinition) | [types.ts:952](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L952) |
|
|
672
738
|
|
|
673
739
|
***
|
|
674
740
|
|
|
@@ -678,7 +744,7 @@ defineEventConsumer for creating event consumers
|
|
|
678
744
|
type EventPublisherConfig<TMessage, TExchange, TRoutingKey> = object;
|
|
679
745
|
```
|
|
680
746
|
|
|
681
|
-
Defined in: [builder/event.ts:
|
|
747
|
+
Defined in: [builder/event.ts:30](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L30)
|
|
682
748
|
|
|
683
749
|
Configuration for an event publisher.
|
|
684
750
|
|
|
@@ -698,11 +764,11 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
698
764
|
|
|
699
765
|
| Property | Type | Description | Defined in |
|
|
700
766
|
| ------ | ------ | ------ | ------ |
|
|
701
|
-
| <a id="__brand-
|
|
702
|
-
| <a id="arguments-3"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:
|
|
703
|
-
| <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:
|
|
704
|
-
| <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:
|
|
705
|
-
| <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:
|
|
767
|
+
| <a id="__brand-6"></a> `__brand` | `"EventPublisherConfig"` | Discriminator to identify this as an event publisher config | [builder/event.ts:36](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L36) |
|
|
768
|
+
| <a id="arguments-3"></a> `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments | [builder/event.ts:44](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L44) |
|
|
769
|
+
| <a id="exchange-5"></a> `exchange` | `TExchange` | The exchange to publish to | [builder/event.ts:38](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L38) |
|
|
770
|
+
| <a id="message-3"></a> `message` | `TMessage` | The message definition | [builder/event.ts:40](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L40) |
|
|
771
|
+
| <a id="routingkey-3"></a> `routingKey` | `TRoutingKey` | The routing key for direct/topic exchanges | [builder/event.ts:42](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L42) |
|
|
706
772
|
|
|
707
773
|
***
|
|
708
774
|
|
|
@@ -712,7 +778,7 @@ publishers broadcast events and consumers subscribe to receive them.
|
|
|
712
778
|
type EventPublisherConfigBase = object;
|
|
713
779
|
```
|
|
714
780
|
|
|
715
|
-
Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/
|
|
781
|
+
Defined in: [types.ts:912](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L912)
|
|
716
782
|
|
|
717
783
|
Base type for event publisher configuration.
|
|
718
784
|
|
|
@@ -727,11 +793,11 @@ defineEventPublisher for creating event publishers
|
|
|
727
793
|
|
|
728
794
|
| Property | Type | Defined in |
|
|
729
795
|
| ------ | ------ | ------ |
|
|
730
|
-
| <a id="__brand-
|
|
731
|
-
| <a id="arguments-4"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:917](https://github.com/btravers/amqp-contract/blob/
|
|
732
|
-
| <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/
|
|
733
|
-
| <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/
|
|
734
|
-
| <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:916](https://github.com/btravers/amqp-contract/blob/
|
|
796
|
+
| <a id="__brand-7"></a> `__brand` | `"EventPublisherConfig"` | [types.ts:913](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L913) |
|
|
797
|
+
| <a id="arguments-4"></a> `arguments?` | `Record`<`string`, `unknown`> | [types.ts:917](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L917) |
|
|
798
|
+
| <a id="exchange-6"></a> `exchange` | [`ExchangeDefinition`](#exchangedefinition) | [types.ts:914](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L914) |
|
|
799
|
+
| <a id="message-4"></a> `message` | [`MessageDefinition`](#messagedefinition) | [types.ts:915](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L915) |
|
|
800
|
+
| <a id="routingkey-4"></a> `routingKey` | `string` \| `undefined` | [types.ts:916](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L916) |
|
|
735
801
|
|
|
736
802
|
***
|
|
737
803
|
|
|
@@ -750,7 +816,7 @@ type ExchangeBindingDefinition = object &
|
|
|
750
816
|
};
|
|
751
817
|
```
|
|
752
818
|
|
|
753
|
-
Defined in: [types.ts:795](https://github.com/btravers/amqp-contract/blob/
|
|
819
|
+
Defined in: [types.ts:795](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L795)
|
|
754
820
|
|
|
755
821
|
Binding between two exchanges (exchange-to-exchange routing).
|
|
756
822
|
|
|
@@ -761,9 +827,9 @@ This allows for more complex routing topologies.
|
|
|
761
827
|
|
|
762
828
|
| Name | Type | Description | Defined in |
|
|
763
829
|
| ------ | ------ | ------ | ------ |
|
|
764
|
-
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:805](https://github.com/btravers/amqp-contract/blob/
|
|
765
|
-
| `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:800](https://github.com/btravers/amqp-contract/blob/
|
|
766
|
-
| `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:797](https://github.com/btravers/amqp-contract/blob/
|
|
830
|
+
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. | [types.ts:805](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L805) |
|
|
831
|
+
| `destination` | [`ExchangeDefinition`](#exchangedefinition) | The destination exchange that will receive forwarded messages | [types.ts:800](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L800) |
|
|
832
|
+
| `type` | `"exchange"` | Discriminator indicating this is an exchange-to-exchange binding | [types.ts:797](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L797) |
|
|
767
833
|
|
|
768
834
|
#### Example
|
|
769
835
|
|
|
@@ -788,7 +854,7 @@ type ExchangeDefinition<TName> =
|
|
|
788
854
|
| TopicExchangeDefinition<TName>;
|
|
789
855
|
```
|
|
790
856
|
|
|
791
|
-
Defined in: [types.ts:471](https://github.com/btravers/amqp-contract/blob/
|
|
857
|
+
Defined in: [types.ts:471](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L471)
|
|
792
858
|
|
|
793
859
|
Union type of all exchange definitions.
|
|
794
860
|
|
|
@@ -808,7 +874,7 @@ Represents any type of AMQP exchange: fanout, direct, or topic.
|
|
|
808
874
|
type FanoutExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
809
875
|
```
|
|
810
876
|
|
|
811
|
-
Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/
|
|
877
|
+
Defined in: [types.ts:421](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L421)
|
|
812
878
|
|
|
813
879
|
A fanout exchange definition.
|
|
814
880
|
|
|
@@ -819,7 +885,7 @@ This is the simplest exchange type for pub/sub messaging patterns.
|
|
|
819
885
|
|
|
820
886
|
| Name | Type | Defined in |
|
|
821
887
|
| ------ | ------ | ------ |
|
|
822
|
-
| `type` | `"fanout"` | [types.ts:423](https://github.com/btravers/amqp-contract/blob/
|
|
888
|
+
| `type` | `"fanout"` | [types.ts:423](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L423) |
|
|
823
889
|
|
|
824
890
|
#### Type Parameters
|
|
825
891
|
|
|
@@ -843,7 +909,7 @@ const logsExchange: FanoutExchangeDefinition = defineExchange('logs', 'fanout',
|
|
|
843
909
|
type InferConsumerNames<TContract> = TContract["consumers"] extends Record<string, unknown> ? keyof TContract["consumers"] : never;
|
|
844
910
|
```
|
|
845
911
|
|
|
846
|
-
Defined in: [types.ts:
|
|
912
|
+
Defined in: [types.ts:1489](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1489)
|
|
847
913
|
|
|
848
914
|
Extract consumer names from a contract.
|
|
849
915
|
|
|
@@ -875,7 +941,7 @@ type ConsumerNames = InferConsumerNames<typeof myContract>;
|
|
|
875
941
|
type InferPublisherNames<TContract> = TContract["publishers"] extends Record<string, unknown> ? keyof TContract["publishers"] : never;
|
|
876
942
|
```
|
|
877
943
|
|
|
878
|
-
Defined in: [types.ts:
|
|
944
|
+
Defined in: [types.ts:1471](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1471)
|
|
879
945
|
|
|
880
946
|
Extract publisher names from a contract.
|
|
881
947
|
|
|
@@ -907,7 +973,7 @@ type PublisherNames = InferPublisherNames<typeof myContract>;
|
|
|
907
973
|
type MatchingRoutingKey<Pattern, Key> = RoutingKey<Key> extends never ? never : BindingPattern<Pattern> extends never ? never : MatchesPattern<Key, Pattern> extends true ? Key : never;
|
|
908
974
|
```
|
|
909
975
|
|
|
910
|
-
Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/
|
|
976
|
+
Defined in: [builder/routing-types.ts:114](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/routing-types.ts#L114)
|
|
911
977
|
|
|
912
978
|
Validate that a routing key matches a binding pattern.
|
|
913
979
|
|
|
@@ -939,7 +1005,7 @@ type InvalidKey = MatchingRoutingKey<"order.*", "user.created">; // never
|
|
|
939
1005
|
type MessageDefinition<TPayload, THeaders> = object;
|
|
940
1006
|
```
|
|
941
1007
|
|
|
942
|
-
Defined in: [types.ts:711](https://github.com/btravers/amqp-contract/blob/
|
|
1008
|
+
Defined in: [types.ts:711](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L711)
|
|
943
1009
|
|
|
944
1010
|
Definition of a message with typed payload and optional headers.
|
|
945
1011
|
|
|
@@ -954,10 +1020,10 @@ Definition of a message with typed payload and optional headers.
|
|
|
954
1020
|
|
|
955
1021
|
| Property | Type | Description | Defined in |
|
|
956
1022
|
| ------ | ------ | ------ | ------ |
|
|
957
|
-
| <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:737](https://github.com/btravers/amqp-contract/blob/
|
|
958
|
-
| <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:725](https://github.com/btravers/amqp-contract/blob/
|
|
959
|
-
| <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:719](https://github.com/btravers/amqp-contract/blob/
|
|
960
|
-
| <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:731](https://github.com/btravers/amqp-contract/blob/
|
|
1023
|
+
| <a id="description"></a> `description?` | `string` | Detailed description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:737](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L737) |
|
|
1024
|
+
| <a id="headers"></a> `headers?` | `THeaders` | Optional headers schema for validating message metadata. Must be a Standard Schema v1 compatible schema. | [types.ts:725](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L725) |
|
|
1025
|
+
| <a id="payload"></a> `payload` | `TPayload` | The payload schema for validating message content. Must be a Standard Schema v1 compatible schema (Zod, Valibot, ArkType, etc.). | [types.ts:719](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L719) |
|
|
1026
|
+
| <a id="summary"></a> `summary?` | `string` | Brief description of the message for documentation purposes. Used in AsyncAPI specification generation. | [types.ts:731](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L731) |
|
|
961
1027
|
|
|
962
1028
|
***
|
|
963
1029
|
|
|
@@ -976,7 +1042,7 @@ type PublisherDefinition<TMessage> = object &
|
|
|
976
1042
|
};
|
|
977
1043
|
```
|
|
978
1044
|
|
|
979
|
-
Defined in: [types.ts:853](https://github.com/btravers/amqp-contract/blob/
|
|
1045
|
+
Defined in: [types.ts:853](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L853)
|
|
980
1046
|
|
|
981
1047
|
Definition of a message publisher.
|
|
982
1048
|
|
|
@@ -990,7 +1056,7 @@ algorithm when calling the publish method.
|
|
|
990
1056
|
|
|
991
1057
|
| Name | Type | Description | Defined in |
|
|
992
1058
|
| ------ | ------ | ------ | ------ |
|
|
993
|
-
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:855](https://github.com/btravers/amqp-contract/blob/
|
|
1059
|
+
| `message` | `TMessage` | The message definition including the payload schema | [types.ts:855](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L855) |
|
|
994
1060
|
|
|
995
1061
|
#### Type Parameters
|
|
996
1062
|
|
|
@@ -1015,10 +1081,11 @@ const publisher: PublisherDefinition = {
|
|
|
1015
1081
|
```ts
|
|
1016
1082
|
type PublisherEntry =
|
|
1017
1083
|
| PublisherDefinition
|
|
1018
|
-
| EventPublisherConfigBase
|
|
1084
|
+
| EventPublisherConfigBase
|
|
1085
|
+
| BridgedPublisherConfigBase;
|
|
1019
1086
|
```
|
|
1020
1087
|
|
|
1021
|
-
Defined in: [types.ts:
|
|
1088
|
+
Defined in: [types.ts:1051](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L1051)
|
|
1022
1089
|
|
|
1023
1090
|
Publisher entry that can be passed to defineContract's publishers section.
|
|
1024
1091
|
|
|
@@ -1043,7 +1110,7 @@ type QueueBindingDefinition = object &
|
|
|
1043
1110
|
};
|
|
1044
1111
|
```
|
|
1045
1112
|
|
|
1046
|
-
Defined in: [types.ts:747](https://github.com/btravers/amqp-contract/blob/
|
|
1113
|
+
Defined in: [types.ts:747](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L747)
|
|
1047
1114
|
|
|
1048
1115
|
Binding between a queue and an exchange.
|
|
1049
1116
|
|
|
@@ -1055,9 +1122,9 @@ For fanout exchanges, no routing key is needed as all messages are broadcast.
|
|
|
1055
1122
|
|
|
1056
1123
|
| Name | Type | Description | Defined in |
|
|
1057
1124
|
| ------ | ------ | ------ | ------ |
|
|
1058
|
-
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:758](https://github.com/btravers/amqp-contract/blob/
|
|
1059
|
-
| `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:752](https://github.com/btravers/amqp-contract/blob/
|
|
1060
|
-
| `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:749](https://github.com/btravers/amqp-contract/blob/
|
|
1125
|
+
| `arguments?` | `Record`<`string`, `unknown`> | Additional AMQP arguments for the binding. Can be used for advanced routing scenarios with the headers exchange type. | [types.ts:758](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L758) |
|
|
1126
|
+
| `queue` | [`QueueDefinition`](#queuedefinition) | The queue that will receive messages | [types.ts:752](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L752) |
|
|
1127
|
+
| `type` | `"queue"` | Discriminator indicating this is a queue-to-exchange binding | [types.ts:749](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L749) |
|
|
1061
1128
|
|
|
1062
1129
|
***
|
|
1063
1130
|
|
|
@@ -1069,7 +1136,7 @@ type QueueDefinition<TName> =
|
|
|
1069
1136
|
| ClassicQueueDefinition<TName>;
|
|
1070
1137
|
```
|
|
1071
1138
|
|
|
1072
|
-
Defined in: [types.ts:632](https://github.com/btravers/amqp-contract/blob/
|
|
1139
|
+
Defined in: [types.ts:632](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L632)
|
|
1073
1140
|
|
|
1074
1141
|
Definition of an AMQP queue.
|
|
1075
1142
|
|
|
@@ -1095,7 +1162,7 @@ type QueueEntry<TName> =
|
|
|
1095
1162
|
| QueueWithTtlBackoffInfrastructure<TName>;
|
|
1096
1163
|
```
|
|
1097
1164
|
|
|
1098
|
-
Defined in: [types.ts:701](https://github.com/btravers/amqp-contract/blob/
|
|
1165
|
+
Defined in: [types.ts:701](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L701)
|
|
1099
1166
|
|
|
1100
1167
|
A queue entry that can be passed to `defineContract`.
|
|
1101
1168
|
|
|
@@ -1115,7 +1182,7 @@ Can be either a plain queue definition or a queue with TTL-backoff infrastructur
|
|
|
1115
1182
|
type QueueType = "quorum" | "classic";
|
|
1116
1183
|
```
|
|
1117
1184
|
|
|
1118
|
-
Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/
|
|
1185
|
+
Defined in: [types.ts:163](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L163)
|
|
1119
1186
|
|
|
1120
1187
|
Supported queue types in RabbitMQ.
|
|
1121
1188
|
|
|
@@ -1154,7 +1221,7 @@ const tempQueue = defineQueue('temp-queue', {
|
|
|
1154
1221
|
type QueueWithTtlBackoffInfrastructure<TName> = object;
|
|
1155
1222
|
```
|
|
1156
1223
|
|
|
1157
|
-
Defined in: [types.ts:662](https://github.com/btravers/amqp-contract/blob/
|
|
1224
|
+
Defined in: [types.ts:662](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L662)
|
|
1158
1225
|
|
|
1159
1226
|
A queue with automatically generated TTL-backoff retry infrastructure.
|
|
1160
1227
|
|
|
@@ -1192,11 +1259,11 @@ const contract = defineContract({
|
|
|
1192
1259
|
|
|
1193
1260
|
| Property | Type | Description | Defined in |
|
|
1194
1261
|
| ------ | ------ | ------ | ------ |
|
|
1195
|
-
| <a id="deadletter"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration from the main queue. Always present since TTL-backoff infrastructure requires a dead letter exchange. | [types.ts:678](https://github.com/btravers/amqp-contract/blob/
|
|
1196
|
-
| <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:693](https://github.com/btravers/amqp-contract/blob/
|
|
1197
|
-
| <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)<`TName`> | The main queue definition. | [types.ts:672](https://github.com/btravers/amqp-contract/blob/
|
|
1198
|
-
| <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:683](https://github.com/btravers/amqp-contract/blob/
|
|
1199
|
-
| <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:688](https://github.com/btravers/amqp-contract/blob/
|
|
1262
|
+
| <a id="deadletter-2"></a> `deadLetter` | [`DeadLetterConfig`](#deadletterconfig) | Dead letter configuration from the main queue. Always present since TTL-backoff infrastructure requires a dead letter exchange. | [types.ts:678](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L678) |
|
|
1263
|
+
| <a id="mainqueueretrybinding"></a> `mainQueueRetryBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes retried messages back to the main queue. | [types.ts:693](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L693) |
|
|
1264
|
+
| <a id="queue-5"></a> `queue` | [`QueueDefinition`](#queuedefinition)<`TName`> | The main queue definition. | [types.ts:672](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L672) |
|
|
1265
|
+
| <a id="waitqueue"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. | [types.ts:683](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L683) |
|
|
1266
|
+
| <a id="waitqueuebinding"></a> `waitQueueBinding` | [`QueueBindingDefinition`](#queuebindingdefinition) | Binding that routes failed messages to the wait queue. | [types.ts:688](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L688) |
|
|
1200
1267
|
|
|
1201
1268
|
***
|
|
1202
1269
|
|
|
@@ -1206,7 +1273,7 @@ const contract = defineContract({
|
|
|
1206
1273
|
type QuorumNativeRetryOptions = object;
|
|
1207
1274
|
```
|
|
1208
1275
|
|
|
1209
|
-
Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/
|
|
1276
|
+
Defined in: [types.ts:72](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L72)
|
|
1210
1277
|
|
|
1211
1278
|
Quorum-Native retry options using RabbitMQ's native delivery limit feature.
|
|
1212
1279
|
|
|
@@ -1226,7 +1293,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
1226
1293
|
|
|
1227
1294
|
| Property | Type | Description | Defined in |
|
|
1228
1295
|
| ------ | ------ | ------ | ------ |
|
|
1229
|
-
| <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/
|
|
1296
|
+
| <a id="mode"></a> `mode` | `"quorum-native"` | Quorum-Native mode uses RabbitMQ's native delivery limit feature. Requires the queue to be a quorum queue with `deliveryLimit` configured. | [types.ts:77](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L77) |
|
|
1230
1297
|
|
|
1231
1298
|
***
|
|
1232
1299
|
|
|
@@ -1236,7 +1303,7 @@ https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling
|
|
|
1236
1303
|
type QuorumQueueDefinition<TName> = BaseQueueDefinition<TName> & object;
|
|
1237
1304
|
```
|
|
1238
1305
|
|
|
1239
|
-
Defined in: [types.ts:545](https://github.com/btravers/amqp-contract/blob/
|
|
1306
|
+
Defined in: [types.ts:545](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L545)
|
|
1240
1307
|
|
|
1241
1308
|
Definition of a quorum queue.
|
|
1242
1309
|
|
|
@@ -1247,11 +1314,11 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
|
|
|
1247
1314
|
|
|
1248
1315
|
| Name | Type | Description | Defined in |
|
|
1249
1316
|
| ------ | ------ | ------ | ------ |
|
|
1250
|
-
| `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. This is a quorum queue-specific feature. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling | [types.ts:575](https://github.com/btravers/amqp-contract/blob/
|
|
1251
|
-
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:555](https://github.com/btravers/amqp-contract/blob/
|
|
1252
|
-
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:561](https://github.com/btravers/amqp-contract/blob/
|
|
1253
|
-
| `retry` | [`ResolvedRetryOptions`](#resolvedretryoptions) | Retry configuration for handling failed message processing. Quorum queues support both: - `ttl-backoff`: Uses wait queues with exponential backoff (default) - `quorum-native`: Uses RabbitMQ's native delivery limit feature When the queue is created, defaults are applied for TTL-backoff options. | [types.ts:586](https://github.com/btravers/amqp-contract/blob/
|
|
1254
|
-
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:549](https://github.com/btravers/amqp-contract/blob/
|
|
1317
|
+
| `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. This is a quorum queue-specific feature. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling | [types.ts:575](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L575) |
|
|
1318
|
+
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:555](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L555) |
|
|
1319
|
+
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:561](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L561) |
|
|
1320
|
+
| `retry` | [`ResolvedRetryOptions`](#resolvedretryoptions) | Retry configuration for handling failed message processing. Quorum queues support both: - `ttl-backoff`: Uses wait queues with exponential backoff (default) - `quorum-native`: Uses RabbitMQ's native delivery limit feature When the queue is created, defaults are applied for TTL-backoff options. | [types.ts:586](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L586) |
|
|
1321
|
+
| `type` | `"quorum"` | Queue type discriminator: quorum queue. | [types.ts:549](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L549) |
|
|
1255
1322
|
|
|
1256
1323
|
#### Type Parameters
|
|
1257
1324
|
|
|
@@ -1267,7 +1334,7 @@ They support native retry handling via `deliveryLimit` and both TTL-backoff and
|
|
|
1267
1334
|
type QuorumQueueOptions = BaseQueueOptions & object;
|
|
1268
1335
|
```
|
|
1269
1336
|
|
|
1270
|
-
Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/
|
|
1337
|
+
Defined in: [types.ts:214](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L214)
|
|
1271
1338
|
|
|
1272
1339
|
Options for creating a quorum queue.
|
|
1273
1340
|
|
|
@@ -1284,11 +1351,11 @@ Quorum queues provide native retry support via `deliveryLimit`:
|
|
|
1284
1351
|
|
|
1285
1352
|
| Name | Type | Description | Defined in |
|
|
1286
1353
|
| ------ | ------ | ------ | ------ |
|
|
1287
|
-
| `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/
|
|
1288
|
-
| `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/
|
|
1289
|
-
| `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/
|
|
1290
|
-
| `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/
|
|
1291
|
-
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/
|
|
1354
|
+
| `deliveryLimit?` | `number` | Maximum number of delivery attempts before the message is dead-lettered. When a message is rejected (nacked) and requeued, RabbitMQ increments the `x-delivery-count` header. When this count reaches the delivery limit, the message is automatically dead-lettered (if DLX is configured) or dropped. This is a quorum queue-specific feature that provides native retry handling without the complexity of TTL-based wait queues. **Benefits over TTL-based retry:** - Simpler architecture (no wait queues needed) - No head-of-queue blocking issues (TTL only works at queue head) - Native RabbitMQ feature with atomic guarantees **Minimum** 1 - Must be a positive integer (1 or greater) **See** https://www.rabbitmq.com/docs/quorum-queues#poison-message-handling **Example** `const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, // Allow up to 5 delivery attempts deadLetter: { exchange: dlx, routingKey: 'order.failed', }, });` | [types.ts:263](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L263) |
|
|
1355
|
+
| `exclusive?` | `never` | Quorum queues do not support exclusive mode. Use type: 'classic' if you need exclusive queues. | [types.ts:224](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L224) |
|
|
1356
|
+
| `maxPriority?` | `never` | Quorum queues do not support priority queues. Use type: 'classic' if you need priority queues. | [types.ts:230](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L230) |
|
|
1357
|
+
| `retry?` | \| [`TtlBackoffRetryOptions`](#ttlbackoffretryoptions) \| [`QuorumNativeRetryOptions`](#quorumnativeretryoptions) | Retry configuration for handling failed message processing. Determines how the worker handles retries for consumers using this queue: - `"ttl-backoff"` (default): Uses wait queues with exponential backoff - `"quorum-native"`: Uses RabbitMQ's native delivery limit feature When using `"ttl-backoff"` mode, the core package will automatically create a wait queue (`{queueName}-wait`) and the necessary bindings. **Example** `// TTL-backoff mode with custom options const orderQueue = defineQueue('order-processing', { type: 'quorum', deadLetter: { exchange: dlx }, retry: { mode: 'ttl-backoff', maxRetries: 5, initialDelayMs: 1000, maxDelayMs: 30000, }, }); // Quorum-native mode const orderQueue = defineQueue('order-processing', { type: 'quorum', deliveryLimit: 5, deadLetter: { exchange: dlx }, retry: { mode: 'quorum-native' }, });` | [types.ts:298](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L298) |
|
|
1358
|
+
| `type?` | `"quorum"` | Queue type: quorum (default, recommended) | [types.ts:218](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L218) |
|
|
1292
1359
|
|
|
1293
1360
|
#### Example
|
|
1294
1361
|
|
|
@@ -1310,7 +1377,7 @@ type ResolvedRetryOptions =
|
|
|
1310
1377
|
| QuorumNativeRetryOptions;
|
|
1311
1378
|
```
|
|
1312
1379
|
|
|
1313
|
-
Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/
|
|
1380
|
+
Defined in: [types.ts:104](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L104)
|
|
1314
1381
|
|
|
1315
1382
|
Resolved retry configuration stored in queue definitions.
|
|
1316
1383
|
|
|
@@ -1326,7 +1393,7 @@ This is a discriminated union based on the `mode` field:
|
|
|
1326
1393
|
type RoutingKey<S> = S extends "" ? never : S extends `${string}*${string}` | `${string}#${string}` ? never : S;
|
|
1327
1394
|
```
|
|
1328
1395
|
|
|
1329
|
-
Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/
|
|
1396
|
+
Defined in: [builder/routing-types.ts:25](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/routing-types.ts#L25)
|
|
1330
1397
|
|
|
1331
1398
|
Type-safe routing key that validates basic format.
|
|
1332
1399
|
|
|
@@ -1360,7 +1427,7 @@ type Invalid2 = RoutingKey<"">; // never (empty string)
|
|
|
1360
1427
|
type TopicExchangeDefinition<TName> = BaseExchangeDefinition<TName> & object;
|
|
1361
1428
|
```
|
|
1362
1429
|
|
|
1363
|
-
Defined in: [types.ts:461](https://github.com/btravers/amqp-contract/blob/
|
|
1430
|
+
Defined in: [types.ts:461](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L461)
|
|
1364
1431
|
|
|
1365
1432
|
A topic exchange definition.
|
|
1366
1433
|
|
|
@@ -1374,7 +1441,7 @@ Words are separated by dots (e.g., `order.created.high-value`).
|
|
|
1374
1441
|
|
|
1375
1442
|
| Name | Type | Defined in |
|
|
1376
1443
|
| ------ | ------ | ------ |
|
|
1377
|
-
| `type` | `"topic"` | [types.ts:463](https://github.com/btravers/amqp-contract/blob/
|
|
1444
|
+
| `type` | `"topic"` | [types.ts:463](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L463) |
|
|
1378
1445
|
|
|
1379
1446
|
#### Type Parameters
|
|
1380
1447
|
|
|
@@ -1399,7 +1466,7 @@ const ordersExchange: TopicExchangeDefinition = defineExchange('orders', 'topic'
|
|
|
1399
1466
|
type TtlBackoffRetryInfrastructure = object;
|
|
1400
1467
|
```
|
|
1401
1468
|
|
|
1402
|
-
Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/
|
|
1469
|
+
Defined in: [builder/ttl-backoff.ts:10](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/ttl-backoff.ts#L10)
|
|
1403
1470
|
|
|
1404
1471
|
Result type for TTL-backoff retry infrastructure builder.
|
|
1405
1472
|
|
|
@@ -1409,9 +1476,9 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
|
|
|
1409
1476
|
|
|
1410
1477
|
| Property | Type | Description | Defined in |
|
|
1411
1478
|
| ------ | ------ | ------ | ------ |
|
|
1412
|
-
| <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/
|
|
1413
|
-
| <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/
|
|
1414
|
-
| <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/
|
|
1479
|
+
| <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/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/ttl-backoff.ts#L23) |
|
|
1480
|
+
| <a id="waitqueue-1"></a> `waitQueue` | [`QueueDefinition`](#queuedefinition) | The wait queue for holding messages during backoff delay. This is a classic queue with a dead letter exchange pointing back to the main queue. | [builder/ttl-backoff.ts:15](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/ttl-backoff.ts#L15) |
|
|
1481
|
+
| <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/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/ttl-backoff.ts#L19) |
|
|
1415
1482
|
|
|
1416
1483
|
***
|
|
1417
1484
|
|
|
@@ -1421,7 +1488,7 @@ Contains the wait queue and bindings needed for TTL-backoff retry.
|
|
|
1421
1488
|
type TtlBackoffRetryOptions = object;
|
|
1422
1489
|
```
|
|
1423
1490
|
|
|
1424
|
-
Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/
|
|
1491
|
+
Defined in: [types.ts:27](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L27)
|
|
1425
1492
|
|
|
1426
1493
|
TTL-Backoff retry options for exponential backoff with configurable delays.
|
|
1427
1494
|
|
|
@@ -1435,12 +1502,12 @@ per-message TTL, then dead-lettered back to the main queue after the TTL expires
|
|
|
1435
1502
|
|
|
1436
1503
|
| Property | Type | Description | Defined in |
|
|
1437
1504
|
| ------ | ------ | ------ | ------ |
|
|
1438
|
-
| <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/
|
|
1439
|
-
| <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/
|
|
1440
|
-
| <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/
|
|
1441
|
-
| <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/
|
|
1442
|
-
| <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/
|
|
1443
|
-
| <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/
|
|
1505
|
+
| <a id="backoffmultiplier-1"></a> `backoffMultiplier?` | `number` | Exponential backoff multiplier. **Default** `2` | [types.ts:51](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L51) |
|
|
1506
|
+
| <a id="initialdelayms-1"></a> `initialDelayMs?` | `number` | Initial delay in ms before first retry. **Default** `1000` | [types.ts:41](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L41) |
|
|
1507
|
+
| <a id="jitter-1"></a> `jitter?` | `boolean` | Add jitter to prevent thundering herd. **Default** `true` | [types.ts:56](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L56) |
|
|
1508
|
+
| <a id="maxdelayms-1"></a> `maxDelayMs?` | `number` | Maximum delay in ms between retries. **Default** `30000` | [types.ts:46](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L46) |
|
|
1509
|
+
| <a id="maxretries-1"></a> `maxRetries?` | `number` | Maximum retry attempts before sending to DLQ. **Default** `3` | [types.ts:36](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L36) |
|
|
1510
|
+
| <a id="mode-1"></a> `mode` | `"ttl-backoff"` | TTL-Backoff mode uses wait queues with per-message TTL for exponential backoff. | [types.ts:31](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/types.ts#L31) |
|
|
1444
1511
|
|
|
1445
1512
|
## Functions
|
|
1446
1513
|
|
|
@@ -1453,7 +1520,7 @@ function defineConsumer<TMessage>(
|
|
|
1453
1520
|
options?): ConsumerDefinition<TMessage>;
|
|
1454
1521
|
```
|
|
1455
1522
|
|
|
1456
|
-
Defined in: [builder/consumer.ts:121](https://github.com/btravers/amqp-contract/blob/
|
|
1523
|
+
Defined in: [builder/consumer.ts:121](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/consumer.ts#L121)
|
|
1457
1524
|
|
|
1458
1525
|
Define a message consumer.
|
|
1459
1526
|
|
|
@@ -1538,7 +1605,7 @@ const processOrderConsumer = defineConsumer(orderQueue, orderMessage);
|
|
|
1538
1605
|
function defineContract<TContract>(definition): ContractOutput<TContract>;
|
|
1539
1606
|
```
|
|
1540
1607
|
|
|
1541
|
-
Defined in: [builder/contract.ts:84](https://github.com/btravers/amqp-contract/blob/
|
|
1608
|
+
Defined in: [builder/contract.ts:84](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/contract.ts#L84)
|
|
1542
1609
|
|
|
1543
1610
|
Define an AMQP contract.
|
|
1544
1611
|
|
|
@@ -1627,7 +1694,7 @@ export const contract = defineContract({
|
|
|
1627
1694
|
function defineMessage<TPayload, THeaders>(payload, options?): MessageDefinition<TPayload, THeaders>;
|
|
1628
1695
|
```
|
|
1629
1696
|
|
|
1630
|
-
Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/
|
|
1697
|
+
Defined in: [builder/message.ts:39](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/message.ts#L39)
|
|
1631
1698
|
|
|
1632
1699
|
Define a message definition with payload and optional headers/metadata.
|
|
1633
1700
|
|
|
@@ -1690,7 +1757,7 @@ const orderMessage = defineMessage(
|
|
|
1690
1757
|
function defineQueue<TName, TDlx>(name, options): QueueDefinition<TName> | QueueWithTtlBackoffInfrastructure<TName> & object;
|
|
1691
1758
|
```
|
|
1692
1759
|
|
|
1693
|
-
Defined in: [builder/queue.ts:246](https://github.com/btravers/amqp-contract/blob/
|
|
1760
|
+
Defined in: [builder/queue.ts:246](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L246)
|
|
1694
1761
|
|
|
1695
1762
|
Define an AMQP queue.
|
|
1696
1763
|
|
|
@@ -1771,7 +1838,7 @@ function defineQueue<TName>(name, options?):
|
|
|
1771
1838
|
| QueueWithTtlBackoffInfrastructure<TName>;
|
|
1772
1839
|
```
|
|
1773
1840
|
|
|
1774
|
-
Defined in: [builder/queue.ts:253](https://github.com/btravers/amqp-contract/blob/
|
|
1841
|
+
Defined in: [builder/queue.ts:253](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L253)
|
|
1775
1842
|
|
|
1776
1843
|
Define an AMQP queue.
|
|
1777
1844
|
|
|
@@ -1852,7 +1919,7 @@ const orderQueue = defineQueue('order-processing', {
|
|
|
1852
1919
|
function defineQuorumQueue<TName>(name, options): QuorumQueueDefinition<TName>;
|
|
1853
1920
|
```
|
|
1854
1921
|
|
|
1855
|
-
Defined in: [builder/queue.ts:
|
|
1922
|
+
Defined in: [builder/queue.ts:451](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L451)
|
|
1856
1923
|
|
|
1857
1924
|
Create a quorum queue with quorum-native retry.
|
|
1858
1925
|
|
|
@@ -1891,7 +1958,7 @@ A quorum queue definition with quorum-native retry
|
|
|
1891
1958
|
const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
|
|
1892
1959
|
|
|
1893
1960
|
const orderQueue = defineQuorumQueue('order-processing', {
|
|
1894
|
-
|
|
1961
|
+
deadLetter: { exchange: dlx },
|
|
1895
1962
|
deliveryLimit: 3, // Retry up to 3 times
|
|
1896
1963
|
});
|
|
1897
1964
|
|
|
@@ -1915,7 +1982,7 @@ const contract = defineContract({
|
|
|
1915
1982
|
function defineTtlBackoffQueue<TName>(name, options): QueueWithTtlBackoffInfrastructure<TName>;
|
|
1916
1983
|
```
|
|
1917
1984
|
|
|
1918
|
-
Defined in: [builder/queue.ts:
|
|
1985
|
+
Defined in: [builder/queue.ts:574](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L574)
|
|
1919
1986
|
|
|
1920
1987
|
Create a queue with TTL-backoff retry (exponential backoff).
|
|
1921
1988
|
|
|
@@ -1959,7 +2026,7 @@ A queue with TTL-backoff infrastructure
|
|
|
1959
2026
|
const dlx = defineExchange('orders-dlx', 'direct', { durable: true });
|
|
1960
2027
|
|
|
1961
2028
|
const orderQueue = defineTtlBackoffQueue('order-processing', {
|
|
1962
|
-
|
|
2029
|
+
deadLetter: { exchange: dlx },
|
|
1963
2030
|
maxRetries: 5,
|
|
1964
2031
|
initialDelayMs: 1000, // Start with 1s delay
|
|
1965
2032
|
maxDelayMs: 30000, // Cap at 30s
|
|
@@ -1990,7 +2057,7 @@ const queueName = extractQueue(orderQueue).name;
|
|
|
1990
2057
|
function defineTtlBackoffRetryInfrastructure(queueEntry, options?): TtlBackoffRetryInfrastructure;
|
|
1991
2058
|
```
|
|
1992
2059
|
|
|
1993
|
-
Defined in: [builder/ttl-backoff.ts:68](https://github.com/btravers/amqp-contract/blob/
|
|
2060
|
+
Defined in: [builder/ttl-backoff.ts:68](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/ttl-backoff.ts#L68)
|
|
1994
2061
|
|
|
1995
2062
|
Create TTL-backoff retry infrastructure for a queue.
|
|
1996
2063
|
|
|
@@ -2054,7 +2121,7 @@ const retryInfra = defineTtlBackoffRetryInfrastructure(orderQueue);
|
|
|
2054
2121
|
function extractConsumer(entry): ConsumerDefinition;
|
|
2055
2122
|
```
|
|
2056
2123
|
|
|
2057
|
-
Defined in: [builder/consumer.ts:55](https://github.com/btravers/amqp-contract/blob/
|
|
2124
|
+
Defined in: [builder/consumer.ts:55](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/consumer.ts#L55)
|
|
2058
2125
|
|
|
2059
2126
|
Extract the ConsumerDefinition from any ConsumerEntry type.
|
|
2060
2127
|
|
|
@@ -2103,7 +2170,7 @@ extractConsumer(consumer3).queue.name; // "my-queue"
|
|
|
2103
2170
|
function extractQueue<T>(entry): ExtractQueueFromEntry<T>;
|
|
2104
2171
|
```
|
|
2105
2172
|
|
|
2106
|
-
Defined in: [builder/queue.ts:127](https://github.com/btravers/amqp-contract/blob/
|
|
2173
|
+
Defined in: [builder/queue.ts:127](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L127)
|
|
2107
2174
|
|
|
2108
2175
|
Extract the plain QueueDefinition from a QueueEntry.
|
|
2109
2176
|
|
|
@@ -2147,7 +2214,7 @@ import { defineQueue, defineTtlBackoffQueue, extractQueue } from '@amqp-contract
|
|
|
2147
2214
|
|
|
2148
2215
|
// TTL-backoff queue returns a wrapper
|
|
2149
2216
|
const orderQueue = defineTtlBackoffQueue('orders', {
|
|
2150
|
-
|
|
2217
|
+
deadLetter: { exchange: dlx },
|
|
2151
2218
|
maxRetries: 3,
|
|
2152
2219
|
});
|
|
2153
2220
|
|
|
@@ -2172,13 +2239,37 @@ console.log(queueDef.deadLetter); // { exchange: dlx, ... }
|
|
|
2172
2239
|
|
|
2173
2240
|
***
|
|
2174
2241
|
|
|
2242
|
+
### isBridgedPublisherConfig()
|
|
2243
|
+
|
|
2244
|
+
```ts
|
|
2245
|
+
function isBridgedPublisherConfig(value): value is BridgedPublisherConfig<MessageDefinition, ExchangeDefinition, ExchangeDefinition>;
|
|
2246
|
+
```
|
|
2247
|
+
|
|
2248
|
+
Defined in: [builder/command.ts:460](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L460)
|
|
2249
|
+
|
|
2250
|
+
Type guard to check if a value is a BridgedPublisherConfig.
|
|
2251
|
+
|
|
2252
|
+
#### Parameters
|
|
2253
|
+
|
|
2254
|
+
| Parameter | Type | Description |
|
|
2255
|
+
| ------ | ------ | ------ |
|
|
2256
|
+
| `value` | `unknown` | The value to check |
|
|
2257
|
+
|
|
2258
|
+
#### Returns
|
|
2259
|
+
|
|
2260
|
+
`value is BridgedPublisherConfig<MessageDefinition, ExchangeDefinition, ExchangeDefinition>`
|
|
2261
|
+
|
|
2262
|
+
True if the value is a BridgedPublisherConfig
|
|
2263
|
+
|
|
2264
|
+
***
|
|
2265
|
+
|
|
2175
2266
|
### isCommandConsumerConfig()
|
|
2176
2267
|
|
|
2177
2268
|
```ts
|
|
2178
2269
|
function isCommandConsumerConfig(value): value is CommandConsumerConfig<MessageDefinition, ExchangeDefinition, string | undefined, QueueDefinition, ExchangeDefinition | undefined>;
|
|
2179
2270
|
```
|
|
2180
2271
|
|
|
2181
|
-
Defined in: [builder/command.ts:
|
|
2272
|
+
Defined in: [builder/command.ts:443](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/command.ts#L443)
|
|
2182
2273
|
|
|
2183
2274
|
Type guard to check if a value is a CommandConsumerConfig.
|
|
2184
2275
|
|
|
@@ -2199,10 +2290,10 @@ True if the value is a CommandConsumerConfig
|
|
|
2199
2290
|
### isEventConsumerResult()
|
|
2200
2291
|
|
|
2201
2292
|
```ts
|
|
2202
|
-
function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition | undefined>;
|
|
2293
|
+
function isEventConsumerResult(value): value is EventConsumerResult<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition | undefined, ExchangeBindingDefinition | undefined, ExchangeDefinition | undefined>;
|
|
2203
2294
|
```
|
|
2204
2295
|
|
|
2205
|
-
Defined in: [builder/event.ts:
|
|
2296
|
+
Defined in: [builder/event.ts:526](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L526)
|
|
2206
2297
|
|
|
2207
2298
|
Type guard to check if a value is an EventConsumerResult.
|
|
2208
2299
|
|
|
@@ -2214,7 +2305,7 @@ Type guard to check if a value is an EventConsumerResult.
|
|
|
2214
2305
|
|
|
2215
2306
|
#### Returns
|
|
2216
2307
|
|
|
2217
|
-
value is EventConsumerResult\<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition \| undefined\>
|
|
2308
|
+
value is EventConsumerResult\<MessageDefinition, ExchangeDefinition, QueueDefinition, ExchangeDefinition \| undefined, ExchangeBindingDefinition \| undefined, ExchangeDefinition \| undefined\>
|
|
2218
2309
|
|
|
2219
2310
|
True if the value is an EventConsumerResult
|
|
2220
2311
|
|
|
@@ -2226,7 +2317,7 @@ True if the value is an EventConsumerResult
|
|
|
2226
2317
|
function isEventPublisherConfig(value): value is EventPublisherConfig<MessageDefinition, ExchangeDefinition, string | undefined>;
|
|
2227
2318
|
```
|
|
2228
2319
|
|
|
2229
|
-
Defined in: [builder/event.ts:
|
|
2320
|
+
Defined in: [builder/event.ts:509](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/event.ts#L509)
|
|
2230
2321
|
|
|
2231
2322
|
Type guard to check if a value is an EventPublisherConfig.
|
|
2232
2323
|
|
|
@@ -2250,7 +2341,7 @@ True if the value is an EventPublisherConfig
|
|
|
2250
2341
|
function isQueueWithTtlBackoffInfrastructure(entry): entry is QueueWithTtlBackoffInfrastructure;
|
|
2251
2342
|
```
|
|
2252
2343
|
|
|
2253
|
-
Defined in: [builder/queue.ts:68](https://github.com/btravers/amqp-contract/blob/
|
|
2344
|
+
Defined in: [builder/queue.ts:68](https://github.com/btravers/amqp-contract/blob/fc480811955c7c63b50aea18b1676c065870bfae/packages/contract/src/builder/queue.ts#L68)
|
|
2254
2345
|
|
|
2255
2346
|
Type guard to check if a queue entry is a QueueWithTtlBackoffInfrastructure.
|
|
2256
2347
|
|