queen-mq 1.0.3 → 1.0.5
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/client-v2/admin/Admin.js +18 -0
- package/package.json +1 -1
package/client-v2/admin/Admin.js
CHANGED
|
@@ -68,6 +68,24 @@ export class Admin {
|
|
|
68
68
|
return this.#httpClient.get(`/api/v1/resources/queues/${encodeURIComponent(name)}`)
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Per-partition backlog for a queue — the cheap sibling of getQueue:
|
|
73
|
+
* watermark arithmetic only, no segments, no timestamps. Shape:
|
|
74
|
+
* {queue, group, pending, partitions: [{partition, pending}]}.
|
|
75
|
+
* Omitting group gives queue-level pending under the same worst-cursor
|
|
76
|
+
* precedence the dashboard publishes; a named group is that group's own
|
|
77
|
+
* backlog per partition. Requires broker >= 1.0.4 — an older broker
|
|
78
|
+
* answers 404 no_such_route, so fall back to getQueue there.
|
|
79
|
+
* @param {string} name - Queue name
|
|
80
|
+
* @param {string|null} [group] - Consumer group (optional)
|
|
81
|
+
* @returns {Promise<object>}
|
|
82
|
+
*/
|
|
83
|
+
async getQueueDepth(name, group = null) {
|
|
84
|
+
logger.log('Admin.getQueueDepth', { name, group })
|
|
85
|
+
const queryString = group ? `?group=${encodeURIComponent(group)}` : ''
|
|
86
|
+
return this.#httpClient.get(`/api/v1/resources/queues/${encodeURIComponent(name)}/depth${queryString}`)
|
|
87
|
+
}
|
|
88
|
+
|
|
71
89
|
/**
|
|
72
90
|
* Clear all messages from a queue
|
|
73
91
|
* @param {string} name - Queue name
|
package/package.json
CHANGED