@amqp-contract/core 0.21.0 → 0.23.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 +168 -18
- package/dist/index.d.cts +57 -78
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +57 -78
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +165 -19
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +120 -157
- package/package.json +4 -4
package/docs/index.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
### AmqpClient
|
|
10
10
|
|
|
11
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
11
|
+
Defined in: [packages/core/src/amqp-client.ts:129](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L129)
|
|
12
12
|
|
|
13
13
|
AMQP client that manages connections and channels with automatic topology setup.
|
|
14
14
|
|
|
@@ -46,7 +46,7 @@ await client.close().resultToPromise();
|
|
|
46
46
|
new AmqpClient(contract, options): AmqpClient;
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
49
|
+
Defined in: [packages/core/src/amqp-client.ts:148](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L148)
|
|
50
50
|
|
|
51
51
|
Create a new AMQP client instance.
|
|
52
52
|
|
|
@@ -74,7 +74,7 @@ The client will automatically:
|
|
|
74
74
|
ack(msg, allUpTo?): void;
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
77
|
+
Defined in: [packages/core/src/amqp-client.ts:326](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L326)
|
|
78
78
|
|
|
79
79
|
Acknowledge a message.
|
|
80
80
|
|
|
@@ -95,7 +95,7 @@ Acknowledge a message.
|
|
|
95
95
|
addSetup(setup): void;
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
98
|
+
Defined in: [packages/core/src/amqp-client.ts:348](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L348)
|
|
99
99
|
|
|
100
100
|
Add a setup function to be called when the channel is created or reconnected.
|
|
101
101
|
|
|
@@ -117,7 +117,7 @@ This is useful for setting up channel-level configuration like prefetch.
|
|
|
117
117
|
cancel(consumerTag): Future<Result<void, TechnicalError>>;
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
120
|
+
Defined in: [packages/core/src/amqp-client.ts:314](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L314)
|
|
121
121
|
|
|
122
122
|
Cancel a consumer by its consumer tag.
|
|
123
123
|
|
|
@@ -139,7 +139,7 @@ A Future that resolves when the consumer is cancelled
|
|
|
139
139
|
close(): Future<Result<void, TechnicalError>>;
|
|
140
140
|
```
|
|
141
141
|
|
|
142
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
142
|
+
Defined in: [packages/core/src/amqp-client.ts:377](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L377)
|
|
143
143
|
|
|
144
144
|
Close the channel and release the connection reference.
|
|
145
145
|
|
|
@@ -163,7 +163,7 @@ consume(
|
|
|
163
163
|
options?): Future<Result<string, TechnicalError>>;
|
|
164
164
|
```
|
|
165
165
|
|
|
166
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
166
|
+
Defined in: [packages/core/src/amqp-client.ts:298](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L298)
|
|
167
167
|
|
|
168
168
|
Start consuming messages from a queue.
|
|
169
169
|
|
|
@@ -187,7 +187,7 @@ A Future with `Result<string>` - the consumer tag
|
|
|
187
187
|
getConnection(): IAmqpConnectionManager;
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
190
|
+
Defined in: [packages/core/src/amqp-client.ts:203](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L203)
|
|
191
191
|
|
|
192
192
|
Get the underlying connection manager
|
|
193
193
|
|
|
@@ -210,7 +210,7 @@ nack(
|
|
|
210
210
|
requeue?): void;
|
|
211
211
|
```
|
|
212
212
|
|
|
213
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
213
|
+
Defined in: [packages/core/src/amqp-client.ts:337](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L337)
|
|
214
214
|
|
|
215
215
|
Negative acknowledge a message.
|
|
216
216
|
|
|
@@ -232,7 +232,7 @@ Negative acknowledge a message.
|
|
|
232
232
|
on(event, listener): void;
|
|
233
233
|
```
|
|
234
234
|
|
|
235
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
235
|
+
Defined in: [packages/core/src/amqp-client.ts:363](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L363)
|
|
236
236
|
|
|
237
237
|
Register an event listener on the channel wrapper.
|
|
238
238
|
|
|
@@ -262,7 +262,7 @@ publish(
|
|
|
262
262
|
options?): Future<Result<boolean, TechnicalError>>;
|
|
263
263
|
```
|
|
264
264
|
|
|
265
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
265
|
+
Defined in: [packages/core/src/amqp-client.ts:261](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L261)
|
|
266
266
|
|
|
267
267
|
Publish a message to an exchange.
|
|
268
268
|
|
|
@@ -290,7 +290,7 @@ sendToQueue(
|
|
|
290
290
|
options?): Future<Result<boolean, TechnicalError>>;
|
|
291
291
|
```
|
|
292
292
|
|
|
293
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
293
|
+
Defined in: [packages/core/src/amqp-client.ts:280](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L280)
|
|
294
294
|
|
|
295
295
|
Publish a message directly to a queue.
|
|
296
296
|
|
|
@@ -314,113 +314,33 @@ A Future with `Result<boolean>` - true if message was sent, false if channel buf
|
|
|
314
314
|
waitForConnect(): Future<Result<void, TechnicalError>>;
|
|
315
315
|
```
|
|
316
316
|
|
|
317
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
317
|
+
Defined in: [packages/core/src/amqp-client.ts:224](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L224)
|
|
318
318
|
|
|
319
319
|
Wait for the channel to be connected and ready.
|
|
320
320
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
A Future that resolves when the channel is connected
|
|
326
|
-
|
|
327
|
-
***
|
|
328
|
-
|
|
329
|
-
### ConnectionManagerSingleton
|
|
330
|
-
|
|
331
|
-
Defined in: [packages/core/src/connection-manager.ts:23](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/core/src/connection-manager.ts#L23)
|
|
332
|
-
|
|
333
|
-
Connection manager singleton for sharing AMQP connections across clients.
|
|
334
|
-
|
|
335
|
-
This singleton implements connection pooling to avoid creating multiple connections
|
|
336
|
-
to the same broker, which is a RabbitMQ best practice. Connections are identified
|
|
337
|
-
by their URLs and connection options, and reference counting ensures connections
|
|
338
|
-
are only closed when all clients have released them.
|
|
339
|
-
|
|
340
|
-
#### Example
|
|
341
|
-
|
|
342
|
-
```typescript
|
|
343
|
-
const manager = ConnectionManagerSingleton.getInstance();
|
|
344
|
-
const connection = manager.getConnection(['amqp://localhost']);
|
|
345
|
-
// ... use connection ...
|
|
346
|
-
await manager.releaseConnection(['amqp://localhost']);
|
|
347
|
-
```
|
|
348
|
-
|
|
349
|
-
#### Methods
|
|
350
|
-
|
|
351
|
-
##### getConnection()
|
|
352
|
-
|
|
353
|
-
```ts
|
|
354
|
-
getConnection(urls, connectionOptions?): IAmqpConnectionManager;
|
|
355
|
-
```
|
|
356
|
-
|
|
357
|
-
Defined in: [packages/core/src/connection-manager.ts:52](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/core/src/connection-manager.ts#L52)
|
|
358
|
-
|
|
359
|
-
Get or create a connection for the given URLs and options.
|
|
321
|
+
If `connectTimeoutMs` was provided in the constructor options, the returned
|
|
322
|
+
Future resolves to `Result.Error<TechnicalError>` once the timeout elapses.
|
|
323
|
+
Without a timeout, this waits forever — amqp-connection-manager retries
|
|
324
|
+
connections indefinitely and never errors on its own.
|
|
360
325
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
| Parameter | Type | Description |
|
|
367
|
-
| ------ | ------ | ------ |
|
|
368
|
-
| `urls` | `ConnectionUrl`[] | AMQP broker URL(s) |
|
|
369
|
-
| `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration |
|
|
326
|
+
NOTE: When using `AmqpClient` directly (not via `TypedAmqpClient` /
|
|
327
|
+
`TypedAmqpWorker`), the constructor has already incremented the pooled
|
|
328
|
+
connection's reference count. Callers must invoke `close()` on the error
|
|
329
|
+
path to release the connection — `waitForConnect` does not do this
|
|
330
|
+
automatically. The typed factories handle this cleanup for you.
|
|
370
331
|
|
|
371
332
|
###### Returns
|
|
372
333
|
|
|
373
|
-
`
|
|
374
|
-
|
|
375
|
-
The AMQP connection manager instance
|
|
376
|
-
|
|
377
|
-
##### releaseConnection()
|
|
378
|
-
|
|
379
|
-
```ts
|
|
380
|
-
releaseConnection(urls, connectionOptions?): Promise<void>;
|
|
381
|
-
```
|
|
382
|
-
|
|
383
|
-
Defined in: [packages/core/src/connection-manager.ts:81](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/core/src/connection-manager.ts#L81)
|
|
384
|
-
|
|
385
|
-
Release a connection reference.
|
|
386
|
-
|
|
387
|
-
Decrements the reference count for the connection. If the count reaches zero,
|
|
388
|
-
the connection is closed and removed from the pool.
|
|
389
|
-
|
|
390
|
-
###### Parameters
|
|
391
|
-
|
|
392
|
-
| Parameter | Type | Description |
|
|
393
|
-
| ------ | ------ | ------ |
|
|
394
|
-
| `urls` | `ConnectionUrl`[] | AMQP broker URL(s) used to identify the connection |
|
|
395
|
-
| `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration used to identify the connection |
|
|
396
|
-
|
|
397
|
-
###### Returns
|
|
398
|
-
|
|
399
|
-
`Promise`<`void`>
|
|
400
|
-
|
|
401
|
-
A promise that resolves when the connection is released (and closed if necessary)
|
|
402
|
-
|
|
403
|
-
##### getInstance()
|
|
404
|
-
|
|
405
|
-
```ts
|
|
406
|
-
static getInstance(): ConnectionManagerSingleton;
|
|
407
|
-
```
|
|
408
|
-
|
|
409
|
-
Defined in: [packages/core/src/connection-manager.ts:35](https://github.com/btravers/amqp-contract/blob/c4431c816689353f677718608623c58fd1757388/packages/core/src/connection-manager.ts#L35)
|
|
410
|
-
|
|
411
|
-
Get the singleton instance of the connection manager.
|
|
412
|
-
|
|
413
|
-
###### Returns
|
|
414
|
-
|
|
415
|
-
[`ConnectionManagerSingleton`](#connectionmanagersingleton)
|
|
334
|
+
`Future`<`Result`<`void`, [`TechnicalError`](#technicalerror)>>
|
|
416
335
|
|
|
417
|
-
|
|
336
|
+
A Future resolving to `Result.Ok(void)` on connect, or
|
|
337
|
+
`Result.Error(TechnicalError)` on timeout / connection failure.
|
|
418
338
|
|
|
419
339
|
***
|
|
420
340
|
|
|
421
341
|
### MessageValidationError
|
|
422
342
|
|
|
423
|
-
Defined in: [packages/core/src/errors.ts:33](https://github.com/btravers/amqp-contract/blob/
|
|
343
|
+
Defined in: [packages/core/src/errors.ts:33](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L33)
|
|
424
344
|
|
|
425
345
|
Error thrown when message validation fails (payload or headers).
|
|
426
346
|
|
|
@@ -447,7 +367,7 @@ The validation issues from the Standard Schema validation
|
|
|
447
367
|
new MessageValidationError(source, issues): MessageValidationError;
|
|
448
368
|
```
|
|
449
369
|
|
|
450
|
-
Defined in: [packages/core/src/errors.ts:34](https://github.com/btravers/amqp-contract/blob/
|
|
370
|
+
Defined in: [packages/core/src/errors.ts:34](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L34)
|
|
451
371
|
|
|
452
372
|
###### Parameters
|
|
453
373
|
|
|
@@ -471,10 +391,10 @@ Error.constructor
|
|
|
471
391
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
472
392
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
473
393
|
| <a id="cause"></a> `cause?` | `public` | `unknown` | - | `Error.cause` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es2022.error.d.ts:24 |
|
|
474
|
-
| <a id="issues"></a> `issues` | `readonly` | `unknown` | - | - | [packages/core/src/errors.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
394
|
+
| <a id="issues"></a> `issues` | `readonly` | `unknown` | - | - | [packages/core/src/errors.ts:36](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L36) |
|
|
475
395
|
| <a id="message"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
|
|
476
396
|
| <a id="name"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
|
|
477
|
-
| <a id="source"></a> `source` | `readonly` | `string` | - | - | [packages/core/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/
|
|
397
|
+
| <a id="source"></a> `source` | `readonly` | `string` | - | - | [packages/core/src/errors.ts:35](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L35) |
|
|
478
398
|
| <a id="stack"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
479
399
|
| <a id="stacktracelimit"></a> `stackTraceLimit` | `static` | `number` | The `Error.stackTraceLimit` property specifies the number of stack frames collected by a stack trace (whether generated by `new Error().stack` or `Error.captureStackTrace(obj)`). The default value is `10` but may be set to any valid JavaScript number. Changes will affect any stack trace captured _after_ the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. | `Error.stackTraceLimit` | node\_modules/.pnpm/@types+node@25.6.0/node\_modules/@types/node/globals.d.ts:67 |
|
|
480
400
|
|
|
@@ -684,7 +604,7 @@ Error.prepareStackTrace
|
|
|
684
604
|
|
|
685
605
|
### TechnicalError
|
|
686
606
|
|
|
687
|
-
Defined in: [packages/core/src/errors.ts:7](https://github.com/btravers/amqp-contract/blob/
|
|
607
|
+
Defined in: [packages/core/src/errors.ts:7](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L7)
|
|
688
608
|
|
|
689
609
|
Error for technical/runtime failures that cannot be prevented by TypeScript.
|
|
690
610
|
|
|
@@ -703,7 +623,7 @@ and other runtime errors. This error is shared across core, worker, and client p
|
|
|
703
623
|
new TechnicalError(message, cause?): TechnicalError;
|
|
704
624
|
```
|
|
705
625
|
|
|
706
|
-
Defined in: [packages/core/src/errors.ts:8](https://github.com/btravers/amqp-contract/blob/
|
|
626
|
+
Defined in: [packages/core/src/errors.ts:8](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L8)
|
|
707
627
|
|
|
708
628
|
###### Parameters
|
|
709
629
|
|
|
@@ -726,7 +646,7 @@ Error.constructor
|
|
|
726
646
|
|
|
727
647
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
728
648
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
729
|
-
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/core/src/errors.ts:10](https://github.com/btravers/amqp-contract/blob/
|
|
649
|
+
| <a id="cause-1"></a> `cause?` | `readonly` | `unknown` | - | `Error.cause` | [packages/core/src/errors.ts:10](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/errors.ts#L10) |
|
|
730
650
|
| <a id="message-1"></a> `message` | `public` | `string` | - | `Error.message` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1075 |
|
|
731
651
|
| <a id="name-1"></a> `name` | `public` | `string` | - | `Error.name` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1074 |
|
|
732
652
|
| <a id="stack-1"></a> `stack?` | `public` | `string` | - | `Error.stack` | node\_modules/.pnpm/typescript@6.0.3/node\_modules/typescript/lib/lib.es5.d.ts:1076 |
|
|
@@ -942,7 +862,7 @@ Error.prepareStackTrace
|
|
|
942
862
|
type AmqpClientOptions = object;
|
|
943
863
|
```
|
|
944
864
|
|
|
945
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
865
|
+
Defined in: [packages/core/src/amqp-client.ts:73](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L73)
|
|
946
866
|
|
|
947
867
|
Options for creating an AMQP client.
|
|
948
868
|
|
|
@@ -950,9 +870,10 @@ Options for creating an AMQP client.
|
|
|
950
870
|
|
|
951
871
|
| Property | Type | Description | Defined in |
|
|
952
872
|
| ------ | ------ | ------ | ------ |
|
|
953
|
-
| <a id="channeloptions"></a> `channelOptions?` | `Partial`<`CreateChannelOpts`> | Optional channel configuration options. | [packages/core/src/amqp-client.ts:
|
|
954
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.). | [packages/core/src/amqp-client.ts:
|
|
955
|
-
| <a id="
|
|
873
|
+
| <a id="channeloptions"></a> `channelOptions?` | `Partial`<`CreateChannelOpts`> | Optional channel configuration options. | [packages/core/src/amqp-client.ts:76](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L76) |
|
|
874
|
+
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.). | [packages/core/src/amqp-client.ts:75](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L75) |
|
|
875
|
+
| <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` \| `null` | Maximum time in ms to wait for the channel to become ready in `waitForConnect`. Defaults to [DEFAULT\_CONNECT\_TIMEOUT\_MS](#default_connect_timeout_ms). Pass `null` to disable the timeout entirely (amqp-connection-manager will retry indefinitely). | [packages/core/src/amqp-client.ts:77](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L77) |
|
|
876
|
+
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support. | [packages/core/src/amqp-client.ts:74](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L74) |
|
|
956
877
|
|
|
957
878
|
***
|
|
958
879
|
|
|
@@ -962,7 +883,7 @@ Options for creating an AMQP client.
|
|
|
962
883
|
type ConsumeCallback = (msg) => void | Promise<void>;
|
|
963
884
|
```
|
|
964
885
|
|
|
965
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
886
|
+
Defined in: [packages/core/src/amqp-client.ts:83](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L83)
|
|
966
887
|
|
|
967
888
|
Callback type for consuming messages.
|
|
968
889
|
|
|
@@ -984,7 +905,7 @@ Callback type for consuming messages.
|
|
|
984
905
|
type ConsumerOptions = Options.Consume & object;
|
|
985
906
|
```
|
|
986
907
|
|
|
987
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
908
|
+
Defined in: [packages/core/src/amqp-client.ts:96](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L96)
|
|
988
909
|
|
|
989
910
|
Consume options that extend amqplib's Options.Consume with optional prefetch support.
|
|
990
911
|
|
|
@@ -992,7 +913,7 @@ Consume options that extend amqplib's Options.Consume with optional prefetch sup
|
|
|
992
913
|
|
|
993
914
|
| Name | Type | Description | Defined in |
|
|
994
915
|
| ------ | ------ | ------ | ------ |
|
|
995
|
-
| `prefetch?` | `number` | Number of messages to prefetch | [packages/core/src/amqp-client.ts:
|
|
916
|
+
| `prefetch?` | `number` | Number of messages to prefetch | [packages/core/src/amqp-client.ts:98](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L98) |
|
|
996
917
|
|
|
997
918
|
***
|
|
998
919
|
|
|
@@ -1002,7 +923,7 @@ Consume options that extend amqplib's Options.Consume with optional prefetch sup
|
|
|
1002
923
|
type Logger = object;
|
|
1003
924
|
```
|
|
1004
925
|
|
|
1005
|
-
Defined in: [packages/core/src/logger.ts:30](https://github.com/btravers/amqp-contract/blob/
|
|
926
|
+
Defined in: [packages/core/src/logger.ts:30](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L30)
|
|
1006
927
|
|
|
1007
928
|
Logger interface for amqp-contract packages.
|
|
1008
929
|
|
|
@@ -1029,7 +950,7 @@ const logger: Logger = {
|
|
|
1029
950
|
debug(message, context?): void;
|
|
1030
951
|
```
|
|
1031
952
|
|
|
1032
|
-
Defined in: [packages/core/src/logger.ts:36](https://github.com/btravers/amqp-contract/blob/
|
|
953
|
+
Defined in: [packages/core/src/logger.ts:36](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L36)
|
|
1033
954
|
|
|
1034
955
|
Log debug level messages
|
|
1035
956
|
|
|
@@ -1050,7 +971,7 @@ Log debug level messages
|
|
|
1050
971
|
error(message, context?): void;
|
|
1051
972
|
```
|
|
1052
973
|
|
|
1053
|
-
Defined in: [packages/core/src/logger.ts:57](https://github.com/btravers/amqp-contract/blob/
|
|
974
|
+
Defined in: [packages/core/src/logger.ts:57](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L57)
|
|
1054
975
|
|
|
1055
976
|
Log error level messages
|
|
1056
977
|
|
|
@@ -1071,7 +992,7 @@ Log error level messages
|
|
|
1071
992
|
info(message, context?): void;
|
|
1072
993
|
```
|
|
1073
994
|
|
|
1074
|
-
Defined in: [packages/core/src/logger.ts:43](https://github.com/btravers/amqp-contract/blob/
|
|
995
|
+
Defined in: [packages/core/src/logger.ts:43](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L43)
|
|
1075
996
|
|
|
1076
997
|
Log info level messages
|
|
1077
998
|
|
|
@@ -1092,7 +1013,7 @@ Log info level messages
|
|
|
1092
1013
|
warn(message, context?): void;
|
|
1093
1014
|
```
|
|
1094
1015
|
|
|
1095
|
-
Defined in: [packages/core/src/logger.ts:50](https://github.com/btravers/amqp-contract/blob/
|
|
1016
|
+
Defined in: [packages/core/src/logger.ts:50](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L50)
|
|
1096
1017
|
|
|
1097
1018
|
Log warning level messages
|
|
1098
1019
|
|
|
@@ -1115,7 +1036,7 @@ Log warning level messages
|
|
|
1115
1036
|
type LoggerContext = Record<string, unknown> & object;
|
|
1116
1037
|
```
|
|
1117
1038
|
|
|
1118
|
-
Defined in: [packages/core/src/logger.ts:9](https://github.com/btravers/amqp-contract/blob/
|
|
1039
|
+
Defined in: [packages/core/src/logger.ts:9](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L9)
|
|
1119
1040
|
|
|
1120
1041
|
Context object for logger methods.
|
|
1121
1042
|
|
|
@@ -1126,7 +1047,7 @@ for common logging context properties.
|
|
|
1126
1047
|
|
|
1127
1048
|
| Name | Type | Defined in |
|
|
1128
1049
|
| ------ | ------ | ------ |
|
|
1129
|
-
| `error?` | `unknown` | [packages/core/src/logger.ts:10](https://github.com/btravers/amqp-contract/blob/
|
|
1050
|
+
| `error?` | `unknown` | [packages/core/src/logger.ts:10](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/logger.ts#L10) |
|
|
1130
1051
|
|
|
1131
1052
|
***
|
|
1132
1053
|
|
|
@@ -1136,7 +1057,7 @@ for common logging context properties.
|
|
|
1136
1057
|
type PublishOptions = Options.Publish & object;
|
|
1137
1058
|
```
|
|
1138
1059
|
|
|
1139
|
-
Defined in: [packages/core/src/amqp-client.ts:
|
|
1060
|
+
Defined in: [packages/core/src/amqp-client.ts:88](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L88)
|
|
1140
1061
|
|
|
1141
1062
|
Publish options that extend amqplib's Options.Publish with optional timeout support.
|
|
1142
1063
|
|
|
@@ -1144,7 +1065,7 @@ Publish options that extend amqplib's Options.Publish with optional timeout supp
|
|
|
1144
1065
|
|
|
1145
1066
|
| Name | Type | Description | Defined in |
|
|
1146
1067
|
| ------ | ------ | ------ | ------ |
|
|
1147
|
-
| `timeout?` | `number` | Message will be rejected after timeout ms | [packages/core/src/amqp-client.ts:
|
|
1068
|
+
| `timeout?` | `number` | Message will be rejected after timeout ms | [packages/core/src/amqp-client.ts:90](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L90) |
|
|
1148
1069
|
|
|
1149
1070
|
***
|
|
1150
1071
|
|
|
@@ -1154,7 +1075,7 @@ Publish options that extend amqplib's Options.Publish with optional timeout supp
|
|
|
1154
1075
|
type TelemetryProvider = object;
|
|
1155
1076
|
```
|
|
1156
1077
|
|
|
1157
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1078
|
+
Defined in: [packages/core/src/telemetry.ts:54](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L54)
|
|
1158
1079
|
|
|
1159
1080
|
Telemetry provider for AMQP operations.
|
|
1160
1081
|
Uses lazy loading to gracefully handle cases where OpenTelemetry is not installed.
|
|
@@ -1163,21 +1084,40 @@ Uses lazy loading to gracefully handle cases where OpenTelemetry is not installe
|
|
|
1163
1084
|
|
|
1164
1085
|
| Property | Type | Description | Defined in |
|
|
1165
1086
|
| ------ | ------ | ------ | ------ |
|
|
1166
|
-
| <a id="getconsumecounter"></a> `getConsumeCounter` | () => `Counter` \| `undefined` | Get a counter for messages consumed. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:
|
|
1167
|
-
| <a id="getconsumelatencyhistogram"></a> `getConsumeLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for consume/process latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:
|
|
1168
|
-
| <a id="
|
|
1169
|
-
| <a id="
|
|
1170
|
-
| <a id="
|
|
1087
|
+
| <a id="getconsumecounter"></a> `getConsumeCounter` | () => `Counter` \| `undefined` | Get a counter for messages consumed. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:71](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L71) |
|
|
1088
|
+
| <a id="getconsumelatencyhistogram"></a> `getConsumeLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for consume/process latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:83](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L83) |
|
|
1089
|
+
| <a id="getlaterpcreplycounter"></a> `getLateRpcReplyCounter` | () => `Counter` \| `undefined` | Get a counter for RPC replies that arrive after the caller has gone away (timeout, cancellation, or unknown correlationId). Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:90](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L90) |
|
|
1090
|
+
| <a id="getpublishcounter"></a> `getPublishCounter` | () => `Counter` \| `undefined` | Get a counter for messages published. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:65](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L65) |
|
|
1091
|
+
| <a id="getpublishlatencyhistogram"></a> `getPublishLatencyHistogram` | () => `Histogram` \| `undefined` | Get a histogram for publish latency. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:77](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L77) |
|
|
1092
|
+
| <a id="gettracer"></a> `getTracer` | () => `Tracer` \| `undefined` | Get a tracer instance for creating spans. Returns undefined if OpenTelemetry is not available. | [packages/core/src/telemetry.ts:59](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L59) |
|
|
1171
1093
|
|
|
1172
1094
|
## Variables
|
|
1173
1095
|
|
|
1096
|
+
### DEFAULT\_CONNECT\_TIMEOUT\_MS
|
|
1097
|
+
|
|
1098
|
+
```ts
|
|
1099
|
+
const DEFAULT_CONNECT_TIMEOUT_MS: 30000 = 30_000;
|
|
1100
|
+
```
|
|
1101
|
+
|
|
1102
|
+
Defined in: [packages/core/src/amqp-client.ts:47](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/amqp-client.ts#L47)
|
|
1103
|
+
|
|
1104
|
+
Default time `waitForConnect` will wait for the broker before erroring out.
|
|
1105
|
+
Defaulting to a finite value (rather than waiting forever) means a fail-fast
|
|
1106
|
+
developer experience: a misconfigured URL, a down broker, or wrong
|
|
1107
|
+
credentials surface as a Result.Error within 30 seconds. Pass `null`
|
|
1108
|
+
explicitly to disable the timeout — `Infinity` and other non-finite values
|
|
1109
|
+
are also coerced to "no timeout" because Node's `setTimeout` clamps large
|
|
1110
|
+
delays to ~24.8 days and silently fires near-immediately on `Infinity`.
|
|
1111
|
+
|
|
1112
|
+
***
|
|
1113
|
+
|
|
1174
1114
|
### defaultTelemetryProvider
|
|
1175
1115
|
|
|
1176
1116
|
```ts
|
|
1177
1117
|
const defaultTelemetryProvider: TelemetryProvider;
|
|
1178
1118
|
```
|
|
1179
1119
|
|
|
1180
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1120
|
+
Defined in: [packages/core/src/telemetry.ts:229](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L229)
|
|
1181
1121
|
|
|
1182
1122
|
Default telemetry provider that uses OpenTelemetry API if available.
|
|
1183
1123
|
|
|
@@ -1189,7 +1129,7 @@ Default telemetry provider that uses OpenTelemetry API if available.
|
|
|
1189
1129
|
const MessagingSemanticConventions: object;
|
|
1190
1130
|
```
|
|
1191
1131
|
|
|
1192
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1132
|
+
Defined in: [packages/core/src/telemetry.ts:26](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L26)
|
|
1193
1133
|
|
|
1194
1134
|
Semantic conventions for AMQP messaging following OpenTelemetry standards.
|
|
1195
1135
|
|
|
@@ -1197,20 +1137,20 @@ Semantic conventions for AMQP messaging following OpenTelemetry standards.
|
|
|
1197
1137
|
|
|
1198
1138
|
| Name | Type | Default value | Defined in |
|
|
1199
1139
|
| ------ | ------ | ------ | ------ |
|
|
1200
|
-
| <a id="property-amqp_consumer_name"></a> `AMQP_CONSUMER_NAME` | `"amqp.consumer.name"` | `"amqp.consumer.name"` | [packages/core/src/telemetry.ts:
|
|
1201
|
-
| <a id="property-amqp_publisher_name"></a> `AMQP_PUBLISHER_NAME` | `"amqp.publisher.name"` | `"amqp.publisher.name"` | [packages/core/src/telemetry.ts:
|
|
1202
|
-
| <a id="property-error_type"></a> `ERROR_TYPE` | `"error.type"` | `"error.type"` | [packages/core/src/telemetry.ts:
|
|
1203
|
-
| <a id="property-messaging_destination"></a> `MESSAGING_DESTINATION` | `"messaging.destination.name"` | `"messaging.destination.name"` | [packages/core/src/telemetry.ts:
|
|
1204
|
-
| <a id="property-messaging_destination_kind"></a> `MESSAGING_DESTINATION_KIND` | `"messaging.destination.kind"` | `"messaging.destination.kind"` | [packages/core/src/telemetry.ts:
|
|
1205
|
-
| <a id="property-messaging_destination_kind_exchange"></a> `MESSAGING_DESTINATION_KIND_EXCHANGE` | `"exchange"` | `"exchange"` | [packages/core/src/telemetry.ts:
|
|
1206
|
-
| <a id="property-messaging_destination_kind_queue"></a> `MESSAGING_DESTINATION_KIND_QUEUE` | `"queue"` | `"queue"` | [packages/core/src/telemetry.ts:
|
|
1207
|
-
| <a id="property-messaging_operation"></a> `MESSAGING_OPERATION` | `"messaging.operation"` | `"messaging.operation"` | [packages/core/src/telemetry.ts:
|
|
1208
|
-
| <a id="property-messaging_operation_process"></a> `MESSAGING_OPERATION_PROCESS` | `"process"` | `"process"` | [packages/core/src/telemetry.ts:
|
|
1209
|
-
| <a id="property-messaging_operation_publish"></a> `MESSAGING_OPERATION_PUBLISH` | `"publish"` | `"publish"` | [packages/core/src/telemetry.ts:
|
|
1210
|
-
| <a id="property-messaging_rabbitmq_message_delivery_tag"></a> `MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG` | `"messaging.rabbitmq.message.delivery_tag"` | `"messaging.rabbitmq.message.delivery_tag"` | [packages/core/src/telemetry.ts:
|
|
1211
|
-
| <a id="property-messaging_rabbitmq_routing_key"></a> `MESSAGING_RABBITMQ_ROUTING_KEY` | `"messaging.rabbitmq.destination.routing_key"` | `"messaging.rabbitmq.destination.routing_key"` | [packages/core/src/telemetry.ts:
|
|
1212
|
-
| <a id="property-messaging_system"></a> `MESSAGING_SYSTEM` | `"messaging.system"` | `"messaging.system"` | [packages/core/src/telemetry.ts:
|
|
1213
|
-
| <a id="property-messaging_system_rabbitmq"></a> `MESSAGING_SYSTEM_RABBITMQ` | `"rabbitmq"` | `"rabbitmq"` | [packages/core/src/telemetry.ts:
|
|
1140
|
+
| <a id="property-amqp_consumer_name"></a> `AMQP_CONSUMER_NAME` | `"amqp.consumer.name"` | `"amqp.consumer.name"` | [packages/core/src/telemetry.ts:37](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L37) |
|
|
1141
|
+
| <a id="property-amqp_publisher_name"></a> `AMQP_PUBLISHER_NAME` | `"amqp.publisher.name"` | `"amqp.publisher.name"` | [packages/core/src/telemetry.ts:36](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L36) |
|
|
1142
|
+
| <a id="property-error_type"></a> `ERROR_TYPE` | `"error.type"` | `"error.type"` | [packages/core/src/telemetry.ts:40](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L40) |
|
|
1143
|
+
| <a id="property-messaging_destination"></a> `MESSAGING_DESTINATION` | `"messaging.destination.name"` | `"messaging.destination.name"` | [packages/core/src/telemetry.ts:29](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L29) |
|
|
1144
|
+
| <a id="property-messaging_destination_kind"></a> `MESSAGING_DESTINATION_KIND` | `"messaging.destination.kind"` | `"messaging.destination.kind"` | [packages/core/src/telemetry.ts:30](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L30) |
|
|
1145
|
+
| <a id="property-messaging_destination_kind_exchange"></a> `MESSAGING_DESTINATION_KIND_EXCHANGE` | `"exchange"` | `"exchange"` | [packages/core/src/telemetry.ts:44](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L44) |
|
|
1146
|
+
| <a id="property-messaging_destination_kind_queue"></a> `MESSAGING_DESTINATION_KIND_QUEUE` | `"queue"` | `"queue"` | [packages/core/src/telemetry.ts:45](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L45) |
|
|
1147
|
+
| <a id="property-messaging_operation"></a> `MESSAGING_OPERATION` | `"messaging.operation"` | `"messaging.operation"` | [packages/core/src/telemetry.ts:31](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L31) |
|
|
1148
|
+
| <a id="property-messaging_operation_process"></a> `MESSAGING_OPERATION_PROCESS` | `"process"` | `"process"` | [packages/core/src/telemetry.ts:47](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L47) |
|
|
1149
|
+
| <a id="property-messaging_operation_publish"></a> `MESSAGING_OPERATION_PUBLISH` | `"publish"` | `"publish"` | [packages/core/src/telemetry.ts:46](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L46) |
|
|
1150
|
+
| <a id="property-messaging_rabbitmq_message_delivery_tag"></a> `MESSAGING_RABBITMQ_MESSAGE_DELIVERY_TAG` | `"messaging.rabbitmq.message.delivery_tag"` | `"messaging.rabbitmq.message.delivery_tag"` | [packages/core/src/telemetry.ts:35](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L35) |
|
|
1151
|
+
| <a id="property-messaging_rabbitmq_routing_key"></a> `MESSAGING_RABBITMQ_ROUTING_KEY` | `"messaging.rabbitmq.destination.routing_key"` | `"messaging.rabbitmq.destination.routing_key"` | [packages/core/src/telemetry.ts:34](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L34) |
|
|
1152
|
+
| <a id="property-messaging_system"></a> `MESSAGING_SYSTEM` | `"messaging.system"` | `"messaging.system"` | [packages/core/src/telemetry.ts:28](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L28) |
|
|
1153
|
+
| <a id="property-messaging_system_rabbitmq"></a> `MESSAGING_SYSTEM_RABBITMQ` | `"rabbitmq"` | `"rabbitmq"` | [packages/core/src/telemetry.ts:43](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L43) |
|
|
1214
1154
|
|
|
1215
1155
|
#### See
|
|
1216
1156
|
|
|
@@ -1224,7 +1164,7 @@ https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/
|
|
|
1224
1164
|
function endSpanError(span, error): void;
|
|
1225
1165
|
```
|
|
1226
1166
|
|
|
1227
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1167
|
+
Defined in: [packages/core/src/telemetry.ts:324](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L324)
|
|
1228
1168
|
|
|
1229
1169
|
End a span with error status.
|
|
1230
1170
|
|
|
@@ -1247,7 +1187,7 @@ End a span with error status.
|
|
|
1247
1187
|
function endSpanSuccess(span): void;
|
|
1248
1188
|
```
|
|
1249
1189
|
|
|
1250
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1190
|
+
Defined in: [packages/core/src/telemetry.ts:309](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L309)
|
|
1251
1191
|
|
|
1252
1192
|
End a span with success status.
|
|
1253
1193
|
|
|
@@ -1274,7 +1214,7 @@ function recordConsumeMetric(
|
|
|
1274
1214
|
durationMs): void;
|
|
1275
1215
|
```
|
|
1276
1216
|
|
|
1277
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1217
|
+
Defined in: [packages/core/src/telemetry.ts:368](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L368)
|
|
1278
1218
|
|
|
1279
1219
|
Record a consume metric.
|
|
1280
1220
|
|
|
@@ -1294,6 +1234,29 @@ Record a consume metric.
|
|
|
1294
1234
|
|
|
1295
1235
|
***
|
|
1296
1236
|
|
|
1237
|
+
### recordLateRpcReply()
|
|
1238
|
+
|
|
1239
|
+
```ts
|
|
1240
|
+
function recordLateRpcReply(provider, reason): void;
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
Defined in: [packages/core/src/telemetry.ts:398](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L398)
|
|
1244
|
+
|
|
1245
|
+
Record an RPC reply that arrived after the caller stopped waiting.
|
|
1246
|
+
|
|
1247
|
+
#### Parameters
|
|
1248
|
+
|
|
1249
|
+
| Parameter | Type | Description |
|
|
1250
|
+
| ------ | ------ | ------ |
|
|
1251
|
+
| `provider` | [`TelemetryProvider`](#telemetryprovider) | - |
|
|
1252
|
+
| `reason` | `"unknown-correlation-id"` \| `"missing-correlation-id"` | Why the reply was orphaned. `"unknown-correlation-id"` is the typical "caller already timed out" case; `"missing-correlation-id"` means the broker delivered a reply with no correlationId at all (a protocol violation by the responder). |
|
|
1253
|
+
|
|
1254
|
+
#### Returns
|
|
1255
|
+
|
|
1256
|
+
`void`
|
|
1257
|
+
|
|
1258
|
+
***
|
|
1259
|
+
|
|
1297
1260
|
### recordPublishMetric()
|
|
1298
1261
|
|
|
1299
1262
|
```ts
|
|
@@ -1305,7 +1268,7 @@ function recordPublishMetric(
|
|
|
1305
1268
|
durationMs): void;
|
|
1306
1269
|
```
|
|
1307
1270
|
|
|
1308
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1271
|
+
Defined in: [packages/core/src/telemetry.ts:341](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L341)
|
|
1309
1272
|
|
|
1310
1273
|
Record a publish metric.
|
|
1311
1274
|
|
|
@@ -1331,7 +1294,7 @@ Record a publish metric.
|
|
|
1331
1294
|
function setupAmqpTopology(channel, contract): Promise<void>;
|
|
1332
1295
|
```
|
|
1333
1296
|
|
|
1334
|
-
Defined in: [packages/core/src/setup.ts:26](https://github.com/btravers/amqp-contract/blob/
|
|
1297
|
+
Defined in: [packages/core/src/setup.ts:26](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/setup.ts#L26)
|
|
1335
1298
|
|
|
1336
1299
|
Setup AMQP topology (exchanges, queues, and bindings) from a contract definition.
|
|
1337
1300
|
|
|
@@ -1379,7 +1342,7 @@ function startConsumeSpan(
|
|
|
1379
1342
|
attributes?): Span | undefined;
|
|
1380
1343
|
```
|
|
1381
1344
|
|
|
1382
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1345
|
+
Defined in: [packages/core/src/telemetry.ts:277](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L277)
|
|
1383
1346
|
|
|
1384
1347
|
Create a span for a consume/process operation.
|
|
1385
1348
|
Returns undefined if OpenTelemetry is not available.
|
|
@@ -1409,7 +1372,7 @@ function startPublishSpan(
|
|
|
1409
1372
|
attributes?): Span | undefined;
|
|
1410
1373
|
```
|
|
1411
1374
|
|
|
1412
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1375
|
+
Defined in: [packages/core/src/telemetry.ts:242](https://github.com/btravers/amqp-contract/blob/cb947e699b512bf57d7ddfcc5ae6e2531e8dfa43/packages/core/src/telemetry.ts#L242)
|
|
1413
1376
|
|
|
1414
1377
|
Create a span for a publish operation.
|
|
1415
1378
|
Returns undefined if OpenTelemetry is not available.
|