@amqp-contract/core 0.22.0 → 0.23.1
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 +94 -9
- package/dist/index.d.cts +44 -87
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +44 -87
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +90 -9
- package/dist/index.mjs.map +1 -1
- package/docs/index.md +108 -158
- package/package.json +6 -6
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L280)
|
|
294
294
|
|
|
295
295
|
Publish a message directly to a queue.
|
|
296
296
|
|
|
@@ -314,7 +314,7 @@ 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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L224)
|
|
318
318
|
|
|
319
319
|
Wait for the channel to be connected and ready.
|
|
320
320
|
|
|
@@ -338,101 +338,9 @@ A Future resolving to `Result.Ok(void)` on connect, or
|
|
|
338
338
|
|
|
339
339
|
***
|
|
340
340
|
|
|
341
|
-
### ConnectionManagerSingleton
|
|
342
|
-
|
|
343
|
-
Defined in: [packages/core/src/connection-manager.ts:23](https://github.com/btravers/amqp-contract/blob/da9b95c747db8d5af9183ca6fe2a6e0af558d1fa/packages/core/src/connection-manager.ts#L23)
|
|
344
|
-
|
|
345
|
-
Connection manager singleton for sharing AMQP connections across clients.
|
|
346
|
-
|
|
347
|
-
This singleton implements connection pooling to avoid creating multiple connections
|
|
348
|
-
to the same broker, which is a RabbitMQ best practice. Connections are identified
|
|
349
|
-
by their URLs and connection options, and reference counting ensures connections
|
|
350
|
-
are only closed when all clients have released them.
|
|
351
|
-
|
|
352
|
-
#### Example
|
|
353
|
-
|
|
354
|
-
```typescript
|
|
355
|
-
const manager = ConnectionManagerSingleton.getInstance();
|
|
356
|
-
const connection = manager.getConnection(['amqp://localhost']);
|
|
357
|
-
// ... use connection ...
|
|
358
|
-
await manager.releaseConnection(['amqp://localhost']);
|
|
359
|
-
```
|
|
360
|
-
|
|
361
|
-
#### Methods
|
|
362
|
-
|
|
363
|
-
##### getConnection()
|
|
364
|
-
|
|
365
|
-
```ts
|
|
366
|
-
getConnection(urls, connectionOptions?): IAmqpConnectionManager;
|
|
367
|
-
```
|
|
368
|
-
|
|
369
|
-
Defined in: [packages/core/src/connection-manager.ts:52](https://github.com/btravers/amqp-contract/blob/da9b95c747db8d5af9183ca6fe2a6e0af558d1fa/packages/core/src/connection-manager.ts#L52)
|
|
370
|
-
|
|
371
|
-
Get or create a connection for the given URLs and options.
|
|
372
|
-
|
|
373
|
-
If a connection already exists with the same URLs and options, it is reused
|
|
374
|
-
and its reference count is incremented. Otherwise, a new connection is created.
|
|
375
|
-
|
|
376
|
-
###### Parameters
|
|
377
|
-
|
|
378
|
-
| Parameter | Type | Description |
|
|
379
|
-
| ------ | ------ | ------ |
|
|
380
|
-
| `urls` | `ConnectionUrl`[] | AMQP broker URL(s) |
|
|
381
|
-
| `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration |
|
|
382
|
-
|
|
383
|
-
###### Returns
|
|
384
|
-
|
|
385
|
-
`IAmqpConnectionManager`
|
|
386
|
-
|
|
387
|
-
The AMQP connection manager instance
|
|
388
|
-
|
|
389
|
-
##### releaseConnection()
|
|
390
|
-
|
|
391
|
-
```ts
|
|
392
|
-
releaseConnection(urls, connectionOptions?): Promise<void>;
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
Defined in: [packages/core/src/connection-manager.ts:81](https://github.com/btravers/amqp-contract/blob/da9b95c747db8d5af9183ca6fe2a6e0af558d1fa/packages/core/src/connection-manager.ts#L81)
|
|
396
|
-
|
|
397
|
-
Release a connection reference.
|
|
398
|
-
|
|
399
|
-
Decrements the reference count for the connection. If the count reaches zero,
|
|
400
|
-
the connection is closed and removed from the pool.
|
|
401
|
-
|
|
402
|
-
###### Parameters
|
|
403
|
-
|
|
404
|
-
| Parameter | Type | Description |
|
|
405
|
-
| ------ | ------ | ------ |
|
|
406
|
-
| `urls` | `ConnectionUrl`[] | AMQP broker URL(s) used to identify the connection |
|
|
407
|
-
| `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration used to identify the connection |
|
|
408
|
-
|
|
409
|
-
###### Returns
|
|
410
|
-
|
|
411
|
-
`Promise`<`void`>
|
|
412
|
-
|
|
413
|
-
A promise that resolves when the connection is released (and closed if necessary)
|
|
414
|
-
|
|
415
|
-
##### getInstance()
|
|
416
|
-
|
|
417
|
-
```ts
|
|
418
|
-
static getInstance(): ConnectionManagerSingleton;
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Defined in: [packages/core/src/connection-manager.ts:35](https://github.com/btravers/amqp-contract/blob/da9b95c747db8d5af9183ca6fe2a6e0af558d1fa/packages/core/src/connection-manager.ts#L35)
|
|
422
|
-
|
|
423
|
-
Get the singleton instance of the connection manager.
|
|
424
|
-
|
|
425
|
-
###### Returns
|
|
426
|
-
|
|
427
|
-
[`ConnectionManagerSingleton`](#connectionmanagersingleton)
|
|
428
|
-
|
|
429
|
-
The singleton instance
|
|
430
|
-
|
|
431
|
-
***
|
|
432
|
-
|
|
433
341
|
### MessageValidationError
|
|
434
342
|
|
|
435
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L33)
|
|
436
344
|
|
|
437
345
|
Error thrown when message validation fails (payload or headers).
|
|
438
346
|
|
|
@@ -459,7 +367,7 @@ The validation issues from the Standard Schema validation
|
|
|
459
367
|
new MessageValidationError(source, issues): MessageValidationError;
|
|
460
368
|
```
|
|
461
369
|
|
|
462
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L34)
|
|
463
371
|
|
|
464
372
|
###### Parameters
|
|
465
373
|
|
|
@@ -483,10 +391,10 @@ Error.constructor
|
|
|
483
391
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
484
392
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
485
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 |
|
|
486
|
-
| <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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L36) |
|
|
487
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 |
|
|
488
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 |
|
|
489
|
-
| <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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L35) |
|
|
490
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 |
|
|
491
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 |
|
|
492
400
|
|
|
@@ -696,7 +604,7 @@ Error.prepareStackTrace
|
|
|
696
604
|
|
|
697
605
|
### TechnicalError
|
|
698
606
|
|
|
699
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L7)
|
|
700
608
|
|
|
701
609
|
Error for technical/runtime failures that cannot be prevented by TypeScript.
|
|
702
610
|
|
|
@@ -715,7 +623,7 @@ and other runtime errors. This error is shared across core, worker, and client p
|
|
|
715
623
|
new TechnicalError(message, cause?): TechnicalError;
|
|
716
624
|
```
|
|
717
625
|
|
|
718
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L8)
|
|
719
627
|
|
|
720
628
|
###### Parameters
|
|
721
629
|
|
|
@@ -738,7 +646,7 @@ Error.constructor
|
|
|
738
646
|
|
|
739
647
|
| Property | Modifier | Type | Description | Inherited from | Defined in |
|
|
740
648
|
| ------ | ------ | ------ | ------ | ------ | ------ |
|
|
741
|
-
| <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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/errors.ts#L10) |
|
|
742
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 |
|
|
743
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 |
|
|
744
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 |
|
|
@@ -954,7 +862,7 @@ Error.prepareStackTrace
|
|
|
954
862
|
type AmqpClientOptions = object;
|
|
955
863
|
```
|
|
956
864
|
|
|
957
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L73)
|
|
958
866
|
|
|
959
867
|
Options for creating an AMQP client.
|
|
960
868
|
|
|
@@ -962,10 +870,10 @@ Options for creating an AMQP client.
|
|
|
962
870
|
|
|
963
871
|
| Property | Type | Description | Defined in |
|
|
964
872
|
| ------ | ------ | ------ | ------ |
|
|
965
|
-
| <a id="channeloptions"></a> `channelOptions?` | `Partial`<`CreateChannelOpts`> | Optional channel configuration options. | [packages/core/src/amqp-client.ts:
|
|
966
|
-
| <a id="connectionoptions"></a> `connectionOptions?` | `AmqpConnectionManagerOptions` | Optional connection configuration (heartbeat, reconnect settings, etc.). | [packages/core/src/amqp-client.ts:
|
|
967
|
-
| <a id="connecttimeoutms"></a> `connectTimeoutMs?` | `number` | Maximum time in ms to wait for the channel to become ready in `waitForConnect`.
|
|
968
|
-
| <a id="urls"></a> `urls` | `ConnectionUrl`[] | AMQP broker URL(s). Multiple URLs provide failover support. | [packages/core/src/amqp-client.ts:
|
|
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L74) |
|
|
969
877
|
|
|
970
878
|
***
|
|
971
879
|
|
|
@@ -975,7 +883,7 @@ Options for creating an AMQP client.
|
|
|
975
883
|
type ConsumeCallback = (msg) => void | Promise<void>;
|
|
976
884
|
```
|
|
977
885
|
|
|
978
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L83)
|
|
979
887
|
|
|
980
888
|
Callback type for consuming messages.
|
|
981
889
|
|
|
@@ -997,7 +905,7 @@ Callback type for consuming messages.
|
|
|
997
905
|
type ConsumerOptions = Options.Consume & object;
|
|
998
906
|
```
|
|
999
907
|
|
|
1000
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L96)
|
|
1001
909
|
|
|
1002
910
|
Consume options that extend amqplib's Options.Consume with optional prefetch support.
|
|
1003
911
|
|
|
@@ -1005,7 +913,7 @@ Consume options that extend amqplib's Options.Consume with optional prefetch sup
|
|
|
1005
913
|
|
|
1006
914
|
| Name | Type | Description | Defined in |
|
|
1007
915
|
| ------ | ------ | ------ | ------ |
|
|
1008
|
-
| `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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L98) |
|
|
1009
917
|
|
|
1010
918
|
***
|
|
1011
919
|
|
|
@@ -1015,7 +923,7 @@ Consume options that extend amqplib's Options.Consume with optional prefetch sup
|
|
|
1015
923
|
type Logger = object;
|
|
1016
924
|
```
|
|
1017
925
|
|
|
1018
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L30)
|
|
1019
927
|
|
|
1020
928
|
Logger interface for amqp-contract packages.
|
|
1021
929
|
|
|
@@ -1042,7 +950,7 @@ const logger: Logger = {
|
|
|
1042
950
|
debug(message, context?): void;
|
|
1043
951
|
```
|
|
1044
952
|
|
|
1045
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L36)
|
|
1046
954
|
|
|
1047
955
|
Log debug level messages
|
|
1048
956
|
|
|
@@ -1063,7 +971,7 @@ Log debug level messages
|
|
|
1063
971
|
error(message, context?): void;
|
|
1064
972
|
```
|
|
1065
973
|
|
|
1066
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L57)
|
|
1067
975
|
|
|
1068
976
|
Log error level messages
|
|
1069
977
|
|
|
@@ -1084,7 +992,7 @@ Log error level messages
|
|
|
1084
992
|
info(message, context?): void;
|
|
1085
993
|
```
|
|
1086
994
|
|
|
1087
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L43)
|
|
1088
996
|
|
|
1089
997
|
Log info level messages
|
|
1090
998
|
|
|
@@ -1105,7 +1013,7 @@ Log info level messages
|
|
|
1105
1013
|
warn(message, context?): void;
|
|
1106
1014
|
```
|
|
1107
1015
|
|
|
1108
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L50)
|
|
1109
1017
|
|
|
1110
1018
|
Log warning level messages
|
|
1111
1019
|
|
|
@@ -1128,7 +1036,7 @@ Log warning level messages
|
|
|
1128
1036
|
type LoggerContext = Record<string, unknown> & object;
|
|
1129
1037
|
```
|
|
1130
1038
|
|
|
1131
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L9)
|
|
1132
1040
|
|
|
1133
1041
|
Context object for logger methods.
|
|
1134
1042
|
|
|
@@ -1139,7 +1047,7 @@ for common logging context properties.
|
|
|
1139
1047
|
|
|
1140
1048
|
| Name | Type | Defined in |
|
|
1141
1049
|
| ------ | ------ | ------ |
|
|
1142
|
-
| `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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/logger.ts#L10) |
|
|
1143
1051
|
|
|
1144
1052
|
***
|
|
1145
1053
|
|
|
@@ -1149,7 +1057,7 @@ for common logging context properties.
|
|
|
1149
1057
|
type PublishOptions = Options.Publish & object;
|
|
1150
1058
|
```
|
|
1151
1059
|
|
|
1152
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L88)
|
|
1153
1061
|
|
|
1154
1062
|
Publish options that extend amqplib's Options.Publish with optional timeout support.
|
|
1155
1063
|
|
|
@@ -1157,7 +1065,7 @@ Publish options that extend amqplib's Options.Publish with optional timeout supp
|
|
|
1157
1065
|
|
|
1158
1066
|
| Name | Type | Description | Defined in |
|
|
1159
1067
|
| ------ | ------ | ------ | ------ |
|
|
1160
|
-
| `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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/amqp-client.ts#L90) |
|
|
1161
1069
|
|
|
1162
1070
|
***
|
|
1163
1071
|
|
|
@@ -1167,7 +1075,7 @@ Publish options that extend amqplib's Options.Publish with optional timeout supp
|
|
|
1167
1075
|
type TelemetryProvider = object;
|
|
1168
1076
|
```
|
|
1169
1077
|
|
|
1170
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1078
|
+
Defined in: [packages/core/src/telemetry.ts:54](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L54)
|
|
1171
1079
|
|
|
1172
1080
|
Telemetry provider for AMQP operations.
|
|
1173
1081
|
Uses lazy loading to gracefully handle cases where OpenTelemetry is not installed.
|
|
@@ -1176,21 +1084,40 @@ Uses lazy loading to gracefully handle cases where OpenTelemetry is not installe
|
|
|
1176
1084
|
|
|
1177
1085
|
| Property | Type | Description | Defined in |
|
|
1178
1086
|
| ------ | ------ | ------ | ------ |
|
|
1179
|
-
| <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:
|
|
1180
|
-
| <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:
|
|
1181
|
-
| <a id="
|
|
1182
|
-
| <a id="
|
|
1183
|
-
| <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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L59) |
|
|
1184
1093
|
|
|
1185
1094
|
## Variables
|
|
1186
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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
|
+
|
|
1187
1114
|
### defaultTelemetryProvider
|
|
1188
1115
|
|
|
1189
1116
|
```ts
|
|
1190
1117
|
const defaultTelemetryProvider: TelemetryProvider;
|
|
1191
1118
|
```
|
|
1192
1119
|
|
|
1193
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1120
|
+
Defined in: [packages/core/src/telemetry.ts:229](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L229)
|
|
1194
1121
|
|
|
1195
1122
|
Default telemetry provider that uses OpenTelemetry API if available.
|
|
1196
1123
|
|
|
@@ -1202,7 +1129,7 @@ Default telemetry provider that uses OpenTelemetry API if available.
|
|
|
1202
1129
|
const MessagingSemanticConventions: object;
|
|
1203
1130
|
```
|
|
1204
1131
|
|
|
1205
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1132
|
+
Defined in: [packages/core/src/telemetry.ts:26](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L26)
|
|
1206
1133
|
|
|
1207
1134
|
Semantic conventions for AMQP messaging following OpenTelemetry standards.
|
|
1208
1135
|
|
|
@@ -1210,20 +1137,20 @@ Semantic conventions for AMQP messaging following OpenTelemetry standards.
|
|
|
1210
1137
|
|
|
1211
1138
|
| Name | Type | Default value | Defined in |
|
|
1212
1139
|
| ------ | ------ | ------ | ------ |
|
|
1213
|
-
| <a id="property-amqp_consumer_name"></a> `AMQP_CONSUMER_NAME` | `"amqp.consumer.name"` | `"amqp.consumer.name"` | [packages/core/src/telemetry.ts:
|
|
1214
|
-
| <a id="property-amqp_publisher_name"></a> `AMQP_PUBLISHER_NAME` | `"amqp.publisher.name"` | `"amqp.publisher.name"` | [packages/core/src/telemetry.ts:
|
|
1215
|
-
| <a id="property-error_type"></a> `ERROR_TYPE` | `"error.type"` | `"error.type"` | [packages/core/src/telemetry.ts:
|
|
1216
|
-
| <a id="property-messaging_destination"></a> `MESSAGING_DESTINATION` | `"messaging.destination.name"` | `"messaging.destination.name"` | [packages/core/src/telemetry.ts:
|
|
1217
|
-
| <a id="property-messaging_destination_kind"></a> `MESSAGING_DESTINATION_KIND` | `"messaging.destination.kind"` | `"messaging.destination.kind"` | [packages/core/src/telemetry.ts:
|
|
1218
|
-
| <a id="property-messaging_destination_kind_exchange"></a> `MESSAGING_DESTINATION_KIND_EXCHANGE` | `"exchange"` | `"exchange"` | [packages/core/src/telemetry.ts:
|
|
1219
|
-
| <a id="property-messaging_destination_kind_queue"></a> `MESSAGING_DESTINATION_KIND_QUEUE` | `"queue"` | `"queue"` | [packages/core/src/telemetry.ts:
|
|
1220
|
-
| <a id="property-messaging_operation"></a> `MESSAGING_OPERATION` | `"messaging.operation"` | `"messaging.operation"` | [packages/core/src/telemetry.ts:
|
|
1221
|
-
| <a id="property-messaging_operation_process"></a> `MESSAGING_OPERATION_PROCESS` | `"process"` | `"process"` | [packages/core/src/telemetry.ts:
|
|
1222
|
-
| <a id="property-messaging_operation_publish"></a> `MESSAGING_OPERATION_PUBLISH` | `"publish"` | `"publish"` | [packages/core/src/telemetry.ts:
|
|
1223
|
-
| <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:
|
|
1224
|
-
| <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:
|
|
1225
|
-
| <a id="property-messaging_system"></a> `MESSAGING_SYSTEM` | `"messaging.system"` | `"messaging.system"` | [packages/core/src/telemetry.ts:
|
|
1226
|
-
| <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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L43) |
|
|
1227
1154
|
|
|
1228
1155
|
#### See
|
|
1229
1156
|
|
|
@@ -1237,7 +1164,7 @@ https://opentelemetry.io/docs/specs/semconv/messaging/messaging-spans/
|
|
|
1237
1164
|
function endSpanError(span, error): void;
|
|
1238
1165
|
```
|
|
1239
1166
|
|
|
1240
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1167
|
+
Defined in: [packages/core/src/telemetry.ts:324](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L324)
|
|
1241
1168
|
|
|
1242
1169
|
End a span with error status.
|
|
1243
1170
|
|
|
@@ -1260,7 +1187,7 @@ End a span with error status.
|
|
|
1260
1187
|
function endSpanSuccess(span): void;
|
|
1261
1188
|
```
|
|
1262
1189
|
|
|
1263
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1190
|
+
Defined in: [packages/core/src/telemetry.ts:309](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L309)
|
|
1264
1191
|
|
|
1265
1192
|
End a span with success status.
|
|
1266
1193
|
|
|
@@ -1287,7 +1214,7 @@ function recordConsumeMetric(
|
|
|
1287
1214
|
durationMs): void;
|
|
1288
1215
|
```
|
|
1289
1216
|
|
|
1290
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1217
|
+
Defined in: [packages/core/src/telemetry.ts:368](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L368)
|
|
1291
1218
|
|
|
1292
1219
|
Record a consume metric.
|
|
1293
1220
|
|
|
@@ -1307,6 +1234,29 @@ Record a consume metric.
|
|
|
1307
1234
|
|
|
1308
1235
|
***
|
|
1309
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/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
|
+
|
|
1310
1260
|
### recordPublishMetric()
|
|
1311
1261
|
|
|
1312
1262
|
```ts
|
|
@@ -1318,7 +1268,7 @@ function recordPublishMetric(
|
|
|
1318
1268
|
durationMs): void;
|
|
1319
1269
|
```
|
|
1320
1270
|
|
|
1321
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1271
|
+
Defined in: [packages/core/src/telemetry.ts:341](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L341)
|
|
1322
1272
|
|
|
1323
1273
|
Record a publish metric.
|
|
1324
1274
|
|
|
@@ -1344,7 +1294,7 @@ Record a publish metric.
|
|
|
1344
1294
|
function setupAmqpTopology(channel, contract): Promise<void>;
|
|
1345
1295
|
```
|
|
1346
1296
|
|
|
1347
|
-
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/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/setup.ts#L26)
|
|
1348
1298
|
|
|
1349
1299
|
Setup AMQP topology (exchanges, queues, and bindings) from a contract definition.
|
|
1350
1300
|
|
|
@@ -1392,7 +1342,7 @@ function startConsumeSpan(
|
|
|
1392
1342
|
attributes?): Span | undefined;
|
|
1393
1343
|
```
|
|
1394
1344
|
|
|
1395
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1345
|
+
Defined in: [packages/core/src/telemetry.ts:277](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L277)
|
|
1396
1346
|
|
|
1397
1347
|
Create a span for a consume/process operation.
|
|
1398
1348
|
Returns undefined if OpenTelemetry is not available.
|
|
@@ -1422,7 +1372,7 @@ function startPublishSpan(
|
|
|
1422
1372
|
attributes?): Span | undefined;
|
|
1423
1373
|
```
|
|
1424
1374
|
|
|
1425
|
-
Defined in: [packages/core/src/telemetry.ts:
|
|
1375
|
+
Defined in: [packages/core/src/telemetry.ts:242](https://github.com/btravers/amqp-contract/blob/dc096282cd7249a6b8148d35c3dfad011c9e9753/packages/core/src/telemetry.ts#L242)
|
|
1426
1376
|
|
|
1427
1377
|
Create a span for a publish operation.
|
|
1428
1378
|
Returns undefined if OpenTelemetry is not available.
|