queen-mq 0.1.1 → 0.1.3

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.
Files changed (149) hide show
  1. package/API.md +1226 -0
  2. package/AUTH.md +2044 -0
  3. package/LICENSE.md +202 -0
  4. package/PROGRAMMATIC_SERVER.md +190 -0
  5. package/README.md +303 -53
  6. package/WEBAPP.md +1889 -0
  7. package/assets/dashboard-01.png +0 -0
  8. package/assets/queen-logo-blue.svg +210 -0
  9. package/assets/queen-logo-cyan.svg +210 -0
  10. package/assets/queen-logo-indigo.svg +210 -0
  11. package/assets/queen-logo-orange.svg +210 -0
  12. package/assets/queen-logo-pink.svg +210 -0
  13. package/assets/queen-logo-purple.svg +210 -0
  14. package/assets/queen-logo-rose.svg +239 -0
  15. package/assets/queen-logo.svg +263 -0
  16. package/examples/batch-processing.js +58 -0
  17. package/examples/programmatic-server.js +58 -0
  18. package/examples/test-cache-multi-server.js +2 -2
  19. package/examples/test-connection-recovery.js +66 -0
  20. package/examples/test-dashboard-api.js +200 -0
  21. package/package.json +4 -2
  22. package/server.log +1 -0
  23. package/src/benchmark/consumer.js +207 -0
  24. package/src/benchmark/consumer_multi.js +216 -0
  25. package/src/benchmark/producer.js +75 -0
  26. package/src/benchmark/producer_multi.js +115 -0
  27. package/src/client/client.js +219 -17
  28. package/src/client/index.js +4 -3
  29. package/src/cluster-server.js +242 -0
  30. package/src/config.js +19 -5
  31. package/src/database/connection.js +42 -16
  32. package/src/database/poolManager.js +7 -0
  33. package/src/database/schema-v2.sql +194 -130
  34. package/src/managers/queueManagerOptimized.js +852 -933
  35. package/src/managers/systemEventManager.js +8 -3
  36. package/src/routes/messages.js +127 -57
  37. package/src/routes/pop.js +27 -43
  38. package/src/routes/resources.js +61 -27
  39. package/src/routes/status.js +1037 -0
  40. package/src/server.js +704 -642
  41. package/src/services/evictionService.js +57 -28
  42. package/src/services/retentionService.js +44 -11
  43. package/src/services/startupSync.js +1 -1
  44. package/src/test/advanced-pattern-tests.js +6 -6
  45. package/src/test/bus-mode-tests.js +24 -11
  46. package/src/test/core-tests.js +110 -0
  47. package/src/test/edge-case-tests.js +12 -5
  48. package/src/test/enterprise-tests.js +48 -15
  49. package/src/test/test-new.js +3 -1
  50. package/src/test/test.js +1 -1
  51. package/src/test/utils.js +1 -1
  52. package/src/test/window-buffer-test.js +114 -0
  53. package/src/utils/streaming.js +231 -0
  54. package/src/utils/uuid.js +2 -2
  55. package/src/websocket/wsServer.js +10 -3
  56. package/test-keepalive-v2.sh +22 -0
  57. package/webapp/COLOR_GUIDE.md +118 -0
  58. package/webapp/README.md +143 -0
  59. package/webapp/index.html +14 -0
  60. package/webapp/package-lock.json +3184 -0
  61. package/webapp/package.json +25 -0
  62. package/webapp/postcss.config.js +7 -0
  63. package/webapp/public/assets/queen-logo-blue.svg +210 -0
  64. package/webapp/public/assets/queen-logo-cyan.svg +210 -0
  65. package/webapp/public/assets/queen-logo-indigo.svg +210 -0
  66. package/webapp/public/assets/queen-logo-orange.svg +210 -0
  67. package/webapp/public/assets/queen-logo-pink.svg +210 -0
  68. package/webapp/public/assets/queen-logo-purple.svg +210 -0
  69. package/webapp/public/assets/queen-logo-rose.svg +239 -0
  70. package/webapp/public/assets/queen-logo.svg +263 -0
  71. package/webapp/src/App.vue +19 -0
  72. package/webapp/src/api/analytics.js +10 -0
  73. package/webapp/src/api/client.js +29 -0
  74. package/webapp/src/api/consumers.js +52 -0
  75. package/webapp/src/api/health.js +7 -0
  76. package/webapp/src/api/messages.js +26 -0
  77. package/webapp/src/api/queues.js +14 -0
  78. package/webapp/src/api/resources.js +8 -0
  79. package/webapp/src/assets/styles/main.css +357 -0
  80. package/webapp/src/components/analytics/AnalyticsFilters.vue +87 -0
  81. package/webapp/src/components/analytics/AnalyticsMetrics.vue +57 -0
  82. package/webapp/src/components/analytics/MessageDistributionChart.vue +111 -0
  83. package/webapp/src/components/analytics/MessageFlowChart.vue +173 -0
  84. package/webapp/src/components/analytics/TimeRangeSelector.vue +27 -0
  85. package/webapp/src/components/analytics/TopQueuesChart.vue +132 -0
  86. package/webapp/src/components/common/ConfirmDialog.vue +56 -0
  87. package/webapp/src/components/common/LoadingSpinner.vue +6 -0
  88. package/webapp/src/components/common/MetricCard.vue +43 -0
  89. package/webapp/src/components/common/StatusBadge.vue +45 -0
  90. package/webapp/src/components/dashboard/MessageStatusCard.vue +50 -0
  91. package/webapp/src/components/dashboard/PerformanceCard.vue +38 -0
  92. package/webapp/src/components/dashboard/ThroughputChart.vue +182 -0
  93. package/webapp/src/components/dashboard/TopQueuesTable.vue +53 -0
  94. package/webapp/src/components/layout/AppLayout.vue +110 -0
  95. package/webapp/src/components/layout/AppSidebar.vue +304 -0
  96. package/webapp/src/components/messages/MessageDetailPanel.vue +242 -0
  97. package/webapp/src/components/messages/MessageFilters.vue +101 -0
  98. package/webapp/src/components/queue-detail/PartitionList.vue +79 -0
  99. package/webapp/src/components/queue-detail/PushMessageModal.vue +175 -0
  100. package/webapp/src/components/queue-detail/QueueConfig.vue +63 -0
  101. package/webapp/src/components/queue-detail/QueueDetailHeader.vue +53 -0
  102. package/webapp/src/components/queue-detail/RecentMessages.vue +76 -0
  103. package/webapp/src/components/queues/CreateQueueModal.vue +193 -0
  104. package/webapp/src/components/queues/QueueFilters.vue +90 -0
  105. package/webapp/src/composables/useApi.js +34 -0
  106. package/webapp/src/composables/useTheme.js +36 -0
  107. package/webapp/src/main.js +11 -0
  108. package/webapp/src/router/index.js +42 -0
  109. package/webapp/src/utils/colors.js +96 -0
  110. package/webapp/src/utils/formatters.js +49 -0
  111. package/webapp/src/views/Analytics.vue +377 -0
  112. package/webapp/src/views/ConsumerGroups.vue +433 -0
  113. package/webapp/src/views/Dashboard.vue +418 -0
  114. package/webapp/src/views/Messages.vue +363 -0
  115. package/webapp/src/views/QueueDetail.vue +582 -0
  116. package/webapp/src/views/Queues.vue +496 -0
  117. package/webapp/tailwind.config.js +25 -0
  118. package/webapp/vite.config.js +10 -0
  119. package/dashboard/.vscode/extensions.json +0 -3
  120. package/dashboard/README.md +0 -5
  121. package/dashboard/index.html +0 -14
  122. package/dashboard/package-lock.json +0 -1458
  123. package/dashboard/package.json +0 -25
  124. package/dashboard/public/vite.svg +0 -1
  125. package/dashboard/src/App.vue +0 -29
  126. package/dashboard/src/assets/styles/main.css +0 -908
  127. package/dashboard/src/assets/vue.svg +0 -1
  128. package/dashboard/src/components/cards/MetricCard.vue +0 -298
  129. package/dashboard/src/components/charts/QueueDepthChart.vue +0 -276
  130. package/dashboard/src/components/charts/QueueLagChart.vue +0 -436
  131. package/dashboard/src/components/charts/ThroughputChart.vue +0 -302
  132. package/dashboard/src/components/common/ActivityFeed.vue +0 -251
  133. package/dashboard/src/components/layout/AppHeader.vue +0 -208
  134. package/dashboard/src/components/layout/AppLayout.vue +0 -88
  135. package/dashboard/src/components/layout/AppSidebar.vue +0 -261
  136. package/dashboard/src/main.js +0 -44
  137. package/dashboard/src/router.js +0 -54
  138. package/dashboard/src/services/api.js +0 -187
  139. package/dashboard/src/services/websocket.js +0 -167
  140. package/dashboard/src/utils/constants.js +0 -56
  141. package/dashboard/src/utils/helpers.js +0 -118
  142. package/dashboard/src/views/Analytics.vue +0 -912
  143. package/dashboard/src/views/Dashboard.vue +0 -906
  144. package/dashboard/src/views/Messages.vue +0 -437
  145. package/dashboard/src/views/QueueDetail.vue +0 -501
  146. package/dashboard/src/views/Queues.vue +0 -333
  147. package/dashboard/vite.config.js +0 -30
  148. package/src/client/queenClient.js +0 -513
  149. package/src/routes/analytics.js +0 -812
package/API.md ADDED
@@ -0,0 +1,1226 @@
1
+ # Queen Message Queue - API Documentation
2
+
3
+ **Base URL:** `http://localhost:6632`
4
+
5
+ **API Version:** v1
6
+
7
+ **Date:** October 15, 2025
8
+
9
+ ---
10
+
11
+ ## Table of Contents
12
+
13
+ 1. [Authentication](#authentication)
14
+ 2. [Health & Monitoring](#health--monitoring)
15
+ 3. [Queue Management](#queue-management)
16
+ 4. [Message Operations](#message-operations)
17
+ 5. [Resource Queries](#resource-queries)
18
+ 6. [Status & Analytics](#status--analytics)
19
+ 7. [Error Responses](#error-responses)
20
+
21
+ ---
22
+
23
+ ## Authentication
24
+
25
+ Currently, the Queen API does not require authentication. All endpoints are publicly accessible. CORS is enabled with the following headers:
26
+
27
+ - `Access-Control-Allow-Origin`: `*`
28
+ - `Access-Control-Allow-Methods`: `GET, POST, PUT, DELETE, OPTIONS`
29
+ - `Access-Control-Allow-Headers`: `Content-Type, Authorization`
30
+
31
+ ---
32
+
33
+ ## Health & Monitoring
34
+
35
+ ### GET /health
36
+
37
+ **Purpose:** Check server health and get basic performance statistics.
38
+
39
+ **Authentication:** None
40
+
41
+ **Query Parameters:** None
42
+
43
+ **Response:**
44
+ ```json
45
+ {
46
+ "status": "healthy",
47
+ "uptime": "30s",
48
+ "connections": 0,
49
+ "stats": {
50
+ "requests": 0,
51
+ "messages": 0,
52
+ "requestsPerSecond": "0.00",
53
+ "messagesPerSecond": "0.00",
54
+ "pool": {
55
+ "total": 3,
56
+ "idle": 3,
57
+ "waiting": 0
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ **Status Codes:**
64
+ - `200`: Server is healthy
65
+ - `503`: Server is unhealthy
66
+
67
+ ---
68
+
69
+ ### GET /metrics
70
+
71
+ **Purpose:** Get detailed performance metrics for monitoring and observability.
72
+
73
+ **Authentication:** None
74
+
75
+ **Query Parameters:** None
76
+
77
+ **Response:**
78
+ ```json
79
+ {
80
+ "uptime": 44.691,
81
+ "requests": {
82
+ "total": 0,
83
+ "rate": 0
84
+ },
85
+ "messages": {
86
+ "total": 0,
87
+ "rate": 0
88
+ },
89
+ "database": {
90
+ "poolSize": 3,
91
+ "idleConnections": 3,
92
+ "waitingRequests": 0
93
+ },
94
+ "memory": {
95
+ "rss": 51740672,
96
+ "heapTotal": 9224192,
97
+ "heapUsed": 7700024,
98
+ "external": 2189469,
99
+ "arrayBuffers": 103809
100
+ },
101
+ "cpu": {
102
+ "user": 179881,
103
+ "system": 47586
104
+ }
105
+ }
106
+ ```
107
+
108
+ **Status Codes:**
109
+ - `200`: Success
110
+
111
+ ---
112
+
113
+ ## Queue Management
114
+
115
+ ### POST /api/v1/configure
116
+
117
+ **Purpose:** Create or configure a queue with specific settings and partitions.
118
+
119
+ **Authentication:** None
120
+
121
+ **Request Body:**
122
+ ```json
123
+ {
124
+ "queue": "test-queue",
125
+ "partition": "Default",
126
+ "ttl": 300,
127
+ "priority": 1,
128
+ "maxQueueSize": 1000
129
+ }
130
+ ```
131
+
132
+ **Parameters:**
133
+ - `queue` (string, required): Queue name
134
+ - `partition` (string, optional): Partition name (defaults to "Default")
135
+ - `ttl` (number, optional): Time-to-live in seconds
136
+ - `priority` (number, optional): Queue priority (0-100)
137
+ - `maxQueueSize` (number, optional): Maximum queue size
138
+ - `leaseTime` (number, optional): Lease time for messages in seconds
139
+ - `retryLimit` (number, optional): Maximum retry attempts
140
+ - `retryDelay` (number, optional): Delay between retries in milliseconds
141
+
142
+ **Response:**
143
+ ```json
144
+ {
145
+ "queue": "test-queue",
146
+ "namespace": null,
147
+ "task": null,
148
+ "configured": true,
149
+ "options": {
150
+ "leaseTime": 300,
151
+ "maxSize": 10000,
152
+ "ttl": 3600,
153
+ "retryLimit": 3,
154
+ "retryDelay": 1000,
155
+ "deadLetterQueue": false,
156
+ "dlqAfterMaxRetries": false,
157
+ "priority": 0,
158
+ "delayedProcessing": 0,
159
+ "windowBuffer": 0,
160
+ "retentionSeconds": 0,
161
+ "completedRetentionSeconds": 0,
162
+ "retentionEnabled": false
163
+ },
164
+ "partition": "Default",
165
+ "_deprecation_notice": "Partition-level configuration is deprecated. All configuration is now at queue level."
166
+ }
167
+ ```
168
+
169
+ **Status Codes:**
170
+ - `201`: Queue configured successfully
171
+ - `400`: Invalid request body
172
+ - `500`: Internal server error
173
+
174
+ ---
175
+
176
+ ## Message Operations
177
+
178
+ ### POST /api/v1/push
179
+
180
+ **Purpose:** Push one or more messages to a queue.
181
+
182
+ **Authentication:** None
183
+
184
+ **Request Body:**
185
+ ```json
186
+ {
187
+ "items": [
188
+ {
189
+ "queue": "test-queue",
190
+ "partition": "Default",
191
+ "payload": {
192
+ "message": "Hello World"
193
+ },
194
+ "ttl": 300,
195
+ "priority": 1,
196
+ "traceId": "optional-trace-id"
197
+ }
198
+ ]
199
+ }
200
+ ```
201
+
202
+ **Parameters:**
203
+ - `items` (array, required): Array of messages to push
204
+ - `queue` (string, required): Queue name
205
+ - `partition` (string, optional): Partition name (defaults to "Default")
206
+ - `payload` (object, required): Message payload (any JSON object)
207
+ - `ttl` (number, optional): Message time-to-live in seconds
208
+ - `priority` (number, optional): Message priority
209
+ - `traceId` (string, optional): Trace ID for distributed tracing
210
+
211
+ **Response:**
212
+ ```json
213
+ {
214
+ "messages": [
215
+ {
216
+ "id": "0199e688-1857-7462-81ea-b87975de7e95",
217
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde",
218
+ "traceId": null,
219
+ "status": "queued"
220
+ }
221
+ ]
222
+ }
223
+ ```
224
+
225
+ **Status Codes:**
226
+ - `201`: Messages pushed successfully
227
+ - `400`: Invalid request body
228
+ - `500`: Internal server error
229
+
230
+ ---
231
+
232
+ ### GET /api/v1/pop/queue/:queue/partition/:partition
233
+
234
+ **Purpose:** Pop messages from a specific queue and partition.
235
+
236
+ **Authentication:** None
237
+
238
+ **Path Parameters:**
239
+ - `queue` (string): Queue name
240
+ - `partition` (string): Partition name
241
+
242
+ **Query Parameters:**
243
+ - `wait` (boolean, optional): Wait for messages if queue is empty (default: false)
244
+ - `timeout` (number, optional): Wait timeout in milliseconds (default: 30000)
245
+ - `batch` (number, optional): Number of messages to pop (default: 1)
246
+ - `consumerGroup` (string, optional): Consumer group name for subscription mode
247
+ - `subscriptionMode` (string, optional): Subscription mode: "earliest", "latest", "timestamp"
248
+ - `subscriptionFrom` (string, optional): Starting point for subscription
249
+
250
+ **Response:**
251
+ ```json
252
+ {
253
+ "messages": [
254
+ {
255
+ "id": "0199e688-1857-7462-81ea-b87975de7e95",
256
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde",
257
+ "traceId": null,
258
+ "queue": "test-queue",
259
+ "partition": "Default",
260
+ "data": {
261
+ "message": "Hello World"
262
+ },
263
+ "payload": {
264
+ "message": "Hello World"
265
+ },
266
+ "retryCount": 0,
267
+ "priority": "0",
268
+ "createdAt": "2025-10-15T06:21:42.865Z",
269
+ "consumerGroup": null
270
+ }
271
+ ]
272
+ }
273
+ ```
274
+
275
+ **Status Codes:**
276
+ - `200`: Messages retrieved successfully
277
+ - `204`: No messages available
278
+ - `500`: Internal server error
279
+
280
+ ---
281
+
282
+ ### GET /api/v1/pop/queue/:queue
283
+
284
+ **Purpose:** Pop messages from a queue (any partition).
285
+
286
+ **Authentication:** None
287
+
288
+ **Path Parameters:**
289
+ - `queue` (string): Queue name
290
+
291
+ **Query Parameters:** Same as `/api/v1/pop/queue/:queue/partition/:partition`
292
+
293
+ **Response:** Same as `/api/v1/pop/queue/:queue/partition/:partition`
294
+
295
+ **Status Codes:**
296
+ - `200`: Messages retrieved successfully
297
+ - `204`: No messages available
298
+ - `500`: Internal server error
299
+
300
+ ---
301
+
302
+ ### GET /api/v1/pop
303
+
304
+ **Purpose:** Pop messages from queues filtered by namespace or task.
305
+
306
+ **Authentication:** None
307
+
308
+ **Query Parameters:**
309
+ - `namespace` (string, optional): Filter by namespace
310
+ - `task` (string, optional): Filter by task
311
+ - `wait` (boolean, optional): Wait for messages if queue is empty
312
+ - `timeout` (number, optional): Wait timeout in milliseconds
313
+ - `batch` (number, optional): Number of messages to pop
314
+ - `consumerGroup` (string, optional): Consumer group name
315
+
316
+ **Response:** Same as `/api/v1/pop/queue/:queue/partition/:partition`
317
+
318
+ **Status Codes:**
319
+ - `200`: Messages retrieved successfully
320
+ - `204`: No messages available
321
+ - `500`: Internal server error
322
+
323
+ ---
324
+
325
+ ### POST /api/v1/ack
326
+
327
+ **Purpose:** Acknowledge a single message as completed or failed.
328
+
329
+ **Authentication:** None
330
+
331
+ **Request Body:**
332
+ ```json
333
+ {
334
+ "transactionId": "0199e688-4d29-7019-bf32-5d4f21306b35",
335
+ "status": "completed",
336
+ "error": "optional error message if failed"
337
+ }
338
+ ```
339
+
340
+ **Parameters:**
341
+ - `transactionId` (string, required): Transaction ID of the message
342
+ - `status` (string, required): "completed" or "failed"
343
+ - `error` (string, optional): Error message if status is "failed"
344
+ - `consumerGroup` (string, optional): Consumer group name
345
+
346
+ **Response:**
347
+ ```json
348
+ {
349
+ "status": "completed",
350
+ "consumerGroup": null,
351
+ "acknowledgedAt": "2025-10-15T06:22:02.382Z"
352
+ }
353
+ ```
354
+
355
+ **Status Codes:**
356
+ - `200`: Acknowledgment successful
357
+ - `400`: Invalid request body
358
+ - `500`: Internal server error
359
+
360
+ ---
361
+
362
+ ### POST /api/v1/ack/batch
363
+
364
+ **Purpose:** Acknowledge multiple messages in a single request.
365
+
366
+ **Authentication:** None
367
+
368
+ **Request Body:**
369
+ ```json
370
+ {
371
+ "acknowledgments": [
372
+ {
373
+ "transactionId": "0199e688-6c45-769d-921b-527ee7c3d57c",
374
+ "status": "completed"
375
+ },
376
+ {
377
+ "transactionId": "0199e688-6c45-769d-921b-55f611d0cd5a",
378
+ "status": "failed",
379
+ "error": "Test error"
380
+ }
381
+ ],
382
+ "consumerGroup": "optional-consumer-group"
383
+ }
384
+ ```
385
+
386
+ **Parameters:**
387
+ - `acknowledgments` (array, required): Array of acknowledgments
388
+ - `transactionId` (string, required): Transaction ID
389
+ - `status` (string, required): "completed" or "failed"
390
+ - `error` (string, optional): Error message if failed
391
+ - `consumerGroup` (string, optional): Consumer group name
392
+
393
+ **Response:**
394
+ ```json
395
+ {
396
+ "processed": 2,
397
+ "results": [
398
+ {
399
+ "transactionId": "0199e688-6c45-769d-921b-527ee7c3d57c",
400
+ "status": "completed"
401
+ },
402
+ {
403
+ "transactionId": "0199e688-6c45-769d-921b-55f611d0cd5a",
404
+ "status": "failed_dlq"
405
+ }
406
+ ]
407
+ }
408
+ ```
409
+
410
+ **Status Codes:**
411
+ - `200`: Batch acknowledgment successful
412
+ - `400`: Invalid request body
413
+ - `500`: Internal server error
414
+
415
+ ---
416
+
417
+ ### GET /api/v1/messages
418
+
419
+ **Purpose:** List messages with optional filters.
420
+
421
+ **Authentication:** None
422
+
423
+ **Query Parameters:**
424
+ - `queue` (string, optional): Filter by queue name
425
+ - `ns` (string, optional): Filter by namespace
426
+ - `task` (string, optional): Filter by task
427
+ - `status` (string, optional): Filter by status
428
+ - `limit` (number, optional): Number of messages to return (default: 100)
429
+ - `offset` (number, optional): Offset for pagination (default: 0)
430
+
431
+ **Response:**
432
+ ```json
433
+ {
434
+ "messages": []
435
+ }
436
+ ```
437
+
438
+ **Note:** This endpoint currently has a database schema issue (`column m.status does not exist`).
439
+
440
+ **Status Codes:**
441
+ - `200`: Success
442
+ - `500`: Internal server error
443
+
444
+ ---
445
+
446
+ ### GET /api/v1/messages/:transactionId
447
+
448
+ **Purpose:** Get details of a specific message by transaction ID.
449
+
450
+ **Authentication:** None
451
+
452
+ **Path Parameters:**
453
+ - `transactionId` (string): Message transaction ID
454
+
455
+ **Response:**
456
+ ```json
457
+ {
458
+ "id": "0199e688-1857-7462-81ea-b87975de7e95",
459
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde",
460
+ "queuePath": "test-queue/Default",
461
+ "queue": "test-queue",
462
+ "partition": "Default",
463
+ "namespace": null,
464
+ "task": null,
465
+ "payload": {
466
+ "message": "Hello World"
467
+ },
468
+ "createdAt": "2025-10-15T06:21:42.865Z",
469
+ "queueConfig": {
470
+ "leaseTime": 300,
471
+ "retryLimit": 3,
472
+ "retryDelay": 1000,
473
+ "ttl": 3600,
474
+ "priority": 0
475
+ }
476
+ }
477
+ ```
478
+
479
+ **Status Codes:**
480
+ - `200`: Message found
481
+ - `404`: Message not found
482
+ - `500`: Internal server error
483
+
484
+ ---
485
+
486
+ ### DELETE /api/v1/messages/:transactionId
487
+
488
+ **Purpose:** Delete a specific message by transaction ID.
489
+
490
+ **Authentication:** None
491
+
492
+ **Path Parameters:**
493
+ - `transactionId` (string): Message transaction ID
494
+
495
+ **Response:**
496
+ ```json
497
+ {
498
+ "deleted": true,
499
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde"
500
+ }
501
+ ```
502
+
503
+ **Status Codes:**
504
+ - `200`: Message deleted
505
+ - `404`: Message not found
506
+ - `500`: Internal server error
507
+
508
+ ---
509
+
510
+ ### POST /api/v1/messages/:transactionId/retry
511
+
512
+ **Purpose:** Retry a failed message.
513
+
514
+ **Authentication:** None
515
+
516
+ **Path Parameters:**
517
+ - `transactionId` (string): Message transaction ID
518
+
519
+ **Response:**
520
+ ```json
521
+ {
522
+ "retried": true,
523
+ "transactionId": "0199e688-a908-726e-9ca2-a2a9b312684d"
524
+ }
525
+ ```
526
+
527
+ **Status Codes:**
528
+ - `200`: Message retried
529
+ - `500`: Internal server error
530
+
531
+ ---
532
+
533
+ ### POST /api/v1/messages/:transactionId/dlq
534
+
535
+ **Purpose:** Move a message to the dead letter queue.
536
+
537
+ **Authentication:** None
538
+
539
+ **Path Parameters:**
540
+ - `transactionId` (string): Message transaction ID
541
+
542
+ **Response:**
543
+ ```json
544
+ {
545
+ "movedToDLQ": true,
546
+ "transactionId": "0199e688-a908-726e-9ca2-a2a9b312684d"
547
+ }
548
+ ```
549
+
550
+ **Status Codes:**
551
+ - `200`: Message moved to DLQ
552
+ - `500`: Internal server error
553
+
554
+ ---
555
+
556
+ ### GET /api/v1/messages/:transactionId/related
557
+
558
+ **Purpose:** Get messages related to a specific message (e.g., by trace ID).
559
+
560
+ **Authentication:** None
561
+
562
+ **Path Parameters:**
563
+ - `transactionId` (string): Message transaction ID
564
+
565
+ **Response:**
566
+ ```json
567
+ {
568
+ "messages": []
569
+ }
570
+ ```
571
+
572
+ **Note:** This endpoint currently has a database schema issue.
573
+
574
+ **Status Codes:**
575
+ - `200`: Success
576
+ - `500`: Internal server error
577
+
578
+ ---
579
+
580
+ ### DELETE /api/v1/queues/:queue/clear
581
+
582
+ **Purpose:** Clear all messages from a queue or specific partition.
583
+
584
+ **Authentication:** None
585
+
586
+ **Path Parameters:**
587
+ - `queue` (string): Queue name
588
+
589
+ **Query Parameters:**
590
+ - `partition` (string, optional): Partition name to clear (if omitted, clears all partitions)
591
+
592
+ **Response:**
593
+ ```json
594
+ {
595
+ "cleared": true,
596
+ "count": 6,
597
+ "queue": "test-queue",
598
+ "partition": "Default"
599
+ }
600
+ ```
601
+
602
+ **Status Codes:**
603
+ - `200`: Queue cleared
604
+ - `500`: Internal server error
605
+
606
+ ---
607
+
608
+ ## Resource Queries
609
+
610
+ ### GET /api/v1/resources/queues
611
+
612
+ **Purpose:** Get a list of all queues with their statistics.
613
+
614
+ **Authentication:** None
615
+
616
+ **Query Parameters:**
617
+ - `namespace` (string, optional): Filter by namespace
618
+ - `task` (string, optional): Filter by task
619
+
620
+ **Response:**
621
+ ```json
622
+ {
623
+ "queues": [
624
+ {
625
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
626
+ "name": "test-queue",
627
+ "namespace": null,
628
+ "task": null,
629
+ "createdAt": "2025-10-15T06:21:42.034Z",
630
+ "partitions": 1,
631
+ "messages": {
632
+ "total": 0,
633
+ "pending": 2,
634
+ "processing": 0
635
+ }
636
+ }
637
+ ]
638
+ }
639
+ ```
640
+
641
+ **Status Codes:**
642
+ - `200`: Success
643
+ - `500`: Internal server error
644
+
645
+ ---
646
+
647
+ ### GET /api/v1/resources/queues/:queue
648
+
649
+ **Purpose:** Get detailed information about a specific queue.
650
+
651
+ **Authentication:** None
652
+
653
+ **Path Parameters:**
654
+ - `queue` (string): Queue name
655
+
656
+ **Response:**
657
+ ```json
658
+ {
659
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
660
+ "name": "test-queue",
661
+ "namespace": null,
662
+ "task": null,
663
+ "createdAt": "2025-10-15T06:21:42.034Z",
664
+ "partitions": [
665
+ {
666
+ "id": "7a30d768-7eb7-40dd-ade9-8afb20c18591",
667
+ "name": "Default",
668
+ "createdAt": "2025-10-15T06:21:42.865Z",
669
+ "stats": {
670
+ "total": 0,
671
+ "pending": 2,
672
+ "processing": 0,
673
+ "completed": 3,
674
+ "failed": 0,
675
+ "deadLetter": 0
676
+ },
677
+ "oldestMessage": null,
678
+ "newestMessage": null
679
+ }
680
+ ],
681
+ "totals": {
682
+ "total": 0,
683
+ "pending": 2,
684
+ "processing": 0,
685
+ "completed": 3,
686
+ "failed": 0,
687
+ "deadLetter": 0
688
+ }
689
+ }
690
+ ```
691
+
692
+ **Status Codes:**
693
+ - `200`: Success
694
+ - `404`: Queue not found
695
+ - `500`: Internal server error
696
+
697
+ ---
698
+
699
+ ### DELETE /api/v1/resources/queues/:queue
700
+
701
+ **Purpose:** Delete a queue and all its messages.
702
+
703
+ **Authentication:** None
704
+
705
+ **Path Parameters:**
706
+ - `queue` (string): Queue name
707
+
708
+ **Response:**
709
+ ```json
710
+ {
711
+ "deleted": true,
712
+ "queue": "test-queue"
713
+ }
714
+ ```
715
+
716
+ **Status Codes:**
717
+ - `200`: Queue deleted
718
+ - `500`: Internal server error
719
+
720
+ ---
721
+
722
+ ### GET /api/v1/resources/partitions
723
+
724
+ **Purpose:** Get a list of partitions across all queues.
725
+
726
+ **Authentication:** None
727
+
728
+ **Query Parameters:**
729
+ - `queue` (string, optional): Filter by queue name
730
+ - `minDepth` (number, optional): Filter partitions with at least this many messages
731
+
732
+ **Response:**
733
+ ```json
734
+ {
735
+ "partitions": [
736
+ {
737
+ "id": "7a30d768-7eb7-40dd-ade9-8afb20c18591",
738
+ "name": "Default",
739
+ "queue": "test-queue",
740
+ "namespace": null,
741
+ "task": null,
742
+ "queuePriority": 0,
743
+ "createdAt": "2025-10-15T06:21:42.865Z",
744
+ "depth": 2,
745
+ "processing": 0,
746
+ "total": 0
747
+ }
748
+ ]
749
+ }
750
+ ```
751
+
752
+ **Status Codes:**
753
+ - `200`: Success
754
+ - `500`: Internal server error
755
+
756
+ ---
757
+
758
+ ### GET /api/v1/resources/namespaces
759
+
760
+ **Purpose:** Get a list of all namespaces with statistics.
761
+
762
+ **Authentication:** None
763
+
764
+ **Query Parameters:** None
765
+
766
+ **Response:**
767
+ ```json
768
+ {
769
+ "namespaces": [
770
+ {
771
+ "namespace": "benchmark",
772
+ "queues": 51,
773
+ "partitions": 510,
774
+ "messages": {
775
+ "total": 200000,
776
+ "pending": 0
777
+ }
778
+ }
779
+ ]
780
+ }
781
+ ```
782
+
783
+ **Status Codes:**
784
+ - `200`: Success
785
+ - `500`: Internal server error
786
+
787
+ ---
788
+
789
+ ### GET /api/v1/resources/tasks
790
+
791
+ **Purpose:** Get a list of all tasks with statistics.
792
+
793
+ **Authentication:** None
794
+
795
+ **Query Parameters:** None
796
+
797
+ **Response:**
798
+ ```json
799
+ {
800
+ "tasks": []
801
+ }
802
+ ```
803
+
804
+ **Status Codes:**
805
+ - `200`: Success
806
+ - `500`: Internal server error
807
+
808
+ ---
809
+
810
+ ### GET /api/v1/resources/overview
811
+
812
+ **Purpose:** Get a comprehensive system overview with all statistics.
813
+
814
+ **Authentication:** None
815
+
816
+ **Query Parameters:** None
817
+
818
+ **Response:**
819
+ ```json
820
+ {
821
+ "queues": 53,
822
+ "partitions": 512,
823
+ "namespaces": 1,
824
+ "tasks": 0,
825
+ "messages": {
826
+ "total": 200000,
827
+ "pending": 2,
828
+ "processing": 0,
829
+ "completed": 16493,
830
+ "failed": 0,
831
+ "deadLetter": 0
832
+ },
833
+ "timestamp": "2025-10-15T06:22:38.014Z"
834
+ }
835
+ ```
836
+
837
+ **Status Codes:**
838
+ - `200`: Success
839
+ - `500`: Internal server error
840
+
841
+ ---
842
+
843
+ ## Status & Analytics
844
+
845
+ ### GET /api/v1/status
846
+
847
+ **Purpose:** Get comprehensive dashboard status including throughput metrics and message statistics.
848
+
849
+ **Authentication:** None
850
+
851
+ **Query Parameters:**
852
+ - `from` (string, optional): Start date/time (ISO 8601)
853
+ - `to` (string, optional): End date/time (ISO 8601)
854
+ - `queue` (string, optional): Filter by queue name
855
+ - `namespace` (string, optional): Filter by namespace
856
+ - `task` (string, optional): Filter by task
857
+
858
+ **Response:**
859
+ ```json
860
+ {
861
+ "timeRange": {
862
+ "from": "2025-10-15T05:22:39.466Z",
863
+ "to": "2025-10-15T06:22:39.466Z"
864
+ },
865
+ "throughput": [
866
+ {
867
+ "timestamp": "2025-10-15T06:22:00.000Z",
868
+ "ingested": 0,
869
+ "processed": 0,
870
+ "ingestedPerSecond": 0,
871
+ "processedPerSecond": 0
872
+ }
873
+ ],
874
+ "queues": [],
875
+ "messages": {
876
+ "total": 0,
877
+ "pending": 2,
878
+ "processing": 0,
879
+ "completed": 16493,
880
+ "failed": 0,
881
+ "deadLetter": 0
882
+ },
883
+ "leases": {
884
+ "active": 0,
885
+ "partitionsWithLeases": 0,
886
+ "totalBatchSize": 0,
887
+ "totalAcked": 0
888
+ },
889
+ "deadLetterQueue": {
890
+ "totalMessages": 0,
891
+ "affectedPartitions": 0,
892
+ "topErrors": []
893
+ }
894
+ }
895
+ ```
896
+
897
+ **Status Codes:**
898
+ - `200`: Success
899
+ - `500`: Internal server error
900
+
901
+ ---
902
+
903
+ ### GET /api/v1/status/queues
904
+
905
+ **Purpose:** Get a list of queues with detailed status information.
906
+
907
+ **Authentication:** None
908
+
909
+ **Query Parameters:**
910
+ - `from` (string, optional): Start date/time
911
+ - `to` (string, optional): End date/time
912
+ - `namespace` (string, optional): Filter by namespace
913
+ - `task` (string, optional): Filter by task
914
+ - `limit` (number, optional): Number of results
915
+ - `offset` (number, optional): Pagination offset
916
+
917
+ **Response:**
918
+ ```json
919
+ {
920
+ "queues": [
921
+ {
922
+ "id": "a6447f65-6c44-423e-a9b7-440fd7136d35",
923
+ "name": "__system_events__",
924
+ "namespace": null,
925
+ "task": null,
926
+ "priority": 100,
927
+ "createdAt": "2025-10-14T12:45:32.356Z",
928
+ "partitions": 1,
929
+ "messages": {
930
+ "total": 0,
931
+ "pending": 0,
932
+ "processing": 0,
933
+ "completed": 0,
934
+ "failed": 0,
935
+ "deadLetter": 0
936
+ },
937
+ "lag": null,
938
+ "performance": null
939
+ }
940
+ ]
941
+ }
942
+ ```
943
+
944
+ **Status Codes:**
945
+ - `200`: Success
946
+ - `500`: Internal server error
947
+
948
+ ---
949
+
950
+ ### GET /api/v1/status/queues/:queue
951
+
952
+ **Purpose:** Get detailed status information for a specific queue.
953
+
954
+ **Authentication:** None
955
+
956
+ **Path Parameters:**
957
+ - `queue` (string): Queue name
958
+
959
+ **Query Parameters:**
960
+ - `from` (string, optional): Start date/time
961
+ - `to` (string, optional): End date/time
962
+
963
+ **Response:**
964
+ ```json
965
+ {
966
+ "queue": {
967
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
968
+ "name": "test-queue",
969
+ "namespace": null,
970
+ "task": null,
971
+ "priority": 0,
972
+ "config": {
973
+ "leaseTime": 300,
974
+ "retryLimit": 3,
975
+ "ttl": 3600,
976
+ "maxQueueSize": 0
977
+ },
978
+ "createdAt": "2025-10-15T06:21:42.034Z"
979
+ },
980
+ "totals": {
981
+ "messages": {
982
+ "total": 0,
983
+ "pending": 0,
984
+ "processing": 0,
985
+ "completed": 3,
986
+ "failed": 0
987
+ },
988
+ "partitions": 1,
989
+ "consumed": 3,
990
+ "batches": 2
991
+ },
992
+ "partitions": [
993
+ {
994
+ "id": "7a30d768-7eb7-40dd-ade9-8afb20c18591",
995
+ "name": "Default",
996
+ "createdAt": "2025-10-15T06:21:42.865Z",
997
+ "lastActivity": "2025-10-15T06:22:21.725Z",
998
+ "messages": {
999
+ "total": 0,
1000
+ "pending": 0,
1001
+ "processing": 0,
1002
+ "completed": 3,
1003
+ "failed": 0
1004
+ },
1005
+ "cursor": {
1006
+ "totalConsumed": 3,
1007
+ "batchesConsumed": 2,
1008
+ "lastConsumedAt": "2025-10-15T06:22:10.537Z"
1009
+ }
1010
+ }
1011
+ ],
1012
+ "timeRange": {
1013
+ "from": "2025-10-15T05:22:47.435Z",
1014
+ "to": "2025-10-15T06:22:47.435Z"
1015
+ }
1016
+ }
1017
+ ```
1018
+
1019
+ **Status Codes:**
1020
+ - `200`: Success
1021
+ - `404`: Queue not found
1022
+ - `500`: Internal server error
1023
+
1024
+ ---
1025
+
1026
+ ### GET /api/v1/status/queues/:queue/messages
1027
+
1028
+ **Purpose:** Get messages from a specific queue with filtering and pagination.
1029
+
1030
+ **Authentication:** None
1031
+
1032
+ **Path Parameters:**
1033
+ - `queue` (string): Queue name
1034
+
1035
+ **Query Parameters:**
1036
+ - `status` (string, optional): Filter by message status
1037
+ - `partition` (string, optional): Filter by partition
1038
+ - `from` (string, optional): Start date/time
1039
+ - `to` (string, optional): End date/time
1040
+ - `limit` (number, optional): Number of results
1041
+ - `offset` (number, optional): Pagination offset
1042
+
1043
+ **Response:**
1044
+ ```json
1045
+ {
1046
+ "messages": [],
1047
+ "pagination": {
1048
+ "limit": 2,
1049
+ "offset": null,
1050
+ "total": 0
1051
+ },
1052
+ "queue": "test-queue",
1053
+ "filters": {
1054
+ "status": null,
1055
+ "partition": null
1056
+ },
1057
+ "timeRange": {
1058
+ "from": "2025-10-15T05:22:48.221Z",
1059
+ "to": "2025-10-15T06:22:48.221Z"
1060
+ }
1061
+ }
1062
+ ```
1063
+
1064
+ **Status Codes:**
1065
+ - `200`: Success
1066
+ - `500`: Internal server error
1067
+
1068
+ ---
1069
+
1070
+ ### GET /api/v1/status/analytics
1071
+
1072
+ **Purpose:** Get analytics data including time series metrics.
1073
+
1074
+ **Authentication:** None
1075
+
1076
+ **Query Parameters:**
1077
+ - `from` (string, optional): Start date/time
1078
+ - `to` (string, optional): End date/time
1079
+ - `queue` (string, optional): Filter by queue
1080
+ - `namespace` (string, optional): Filter by namespace
1081
+ - `task` (string, optional): Filter by task
1082
+ - `interval` (string, optional): Time interval: "minute", "hour", "day" (default: "hour")
1083
+
1084
+ **Response:**
1085
+ ```json
1086
+ {
1087
+ "timeRange": {
1088
+ "from": "2025-10-15T05:22:50.000Z",
1089
+ "to": "2025-10-15T06:22:50.000Z"
1090
+ },
1091
+ "interval": "hour",
1092
+ "timeSeries": [],
1093
+ "summary": null
1094
+ }
1095
+ ```
1096
+
1097
+ **Status Codes:**
1098
+ - `200`: Success
1099
+ - `500`: Internal server error
1100
+
1101
+ ---
1102
+
1103
+ ## Error Responses
1104
+
1105
+ All endpoints may return error responses in the following format:
1106
+
1107
+ ```json
1108
+ {
1109
+ "error": "Error message description"
1110
+ }
1111
+ ```
1112
+
1113
+ ### Common Status Codes:
1114
+
1115
+ - `200 OK`: Request successful
1116
+ - `201 Created`: Resource created successfully
1117
+ - `204 No Content`: Request successful but no content to return
1118
+ - `400 Bad Request`: Invalid request parameters or body
1119
+ - `404 Not Found`: Resource not found
1120
+ - `500 Internal Server Error`: Server error
1121
+ - `503 Service Unavailable`: Server is unhealthy or unavailable
1122
+
1123
+ ---
1124
+
1125
+ ## WebSocket API
1126
+
1127
+ Queen also provides a WebSocket connection for real-time updates:
1128
+
1129
+ **WebSocket URL:** `ws://localhost:6632/ws/dashboard`
1130
+
1131
+ **Purpose:** Real-time updates for:
1132
+ - Queue depth changes
1133
+ - Message events (pushed, processing, completed, failed)
1134
+ - System statistics
1135
+
1136
+ ---
1137
+
1138
+ ## Notes
1139
+
1140
+ 1. **CORS**: All endpoints support CORS with permissive settings. In production, configure appropriate CORS settings.
1141
+
1142
+ 2. **Pagination**: Most list endpoints support pagination via `limit` and `offset` query parameters.
1143
+
1144
+ 3. **Time Ranges**: Status and analytics endpoints default to the last 1 hour if no time range is specified.
1145
+
1146
+ 4. **Consumer Groups**: Queen supports consumer groups for subscription-based message consumption, enabling multiple consumers to process messages in parallel without duplication.
1147
+
1148
+ 5. **Partitions**: Messages can be organized into partitions for better parallelism and ordering guarantees within partitions.
1149
+
1150
+ 6. **Namespaces and Tasks**: Optional organizational features for grouping queues logically.
1151
+
1152
+ 7. **Dead Letter Queue (DLQ)**: Failed messages can be moved to a DLQ for later analysis and reprocessing.
1153
+
1154
+ 8. **Encryption**: Encryption can be enabled by setting the `QUEEN_ENCRYPTION_KEY` environment variable.
1155
+
1156
+ ---
1157
+
1158
+ ## Examples
1159
+
1160
+ ### Creating a Queue and Sending Messages
1161
+
1162
+ ```bash
1163
+ # 1. Create a queue
1164
+ curl -X POST http://localhost:6632/api/v1/configure \
1165
+ -H "Content-Type: application/json" \
1166
+ -d '{
1167
+ "queue": "my-queue",
1168
+ "partition": "Default",
1169
+ "ttl": 3600,
1170
+ "priority": 1
1171
+ }'
1172
+
1173
+ # 2. Push messages
1174
+ curl -X POST http://localhost:6632/api/v1/push \
1175
+ -H "Content-Type: application/json" \
1176
+ -d '{
1177
+ "items": [
1178
+ {
1179
+ "queue": "my-queue",
1180
+ "partition": "Default",
1181
+ "payload": {"task": "process-order", "orderId": 123}
1182
+ }
1183
+ ]
1184
+ }'
1185
+
1186
+ # 3. Pop messages
1187
+ curl "http://localhost:6632/api/v1/pop/queue/my-queue?batch=10"
1188
+
1189
+ # 4. Acknowledge message
1190
+ curl -X POST http://localhost:6632/api/v1/ack \
1191
+ -H "Content-Type: application/json" \
1192
+ -d '{
1193
+ "transactionId": "<transaction-id-from-pop>",
1194
+ "status": "completed"
1195
+ }'
1196
+ ```
1197
+
1198
+ ### Long Polling
1199
+
1200
+ ```bash
1201
+ # Wait up to 30 seconds for messages
1202
+ curl "http://localhost:6632/api/v1/pop/queue/my-queue?wait=true&timeout=30000&batch=10"
1203
+ ```
1204
+
1205
+ ### Subscription Mode (Consumer Groups)
1206
+
1207
+ ```bash
1208
+ # Subscribe from earliest message
1209
+ curl "http://localhost:6632/api/v1/pop/queue/my-queue?consumerGroup=worker-group-1&subscriptionMode=earliest&batch=10"
1210
+
1211
+ # Acknowledge for consumer group
1212
+ curl -X POST http://localhost:6632/api/v1/ack \
1213
+ -H "Content-Type: application/json" \
1214
+ -d '{
1215
+ "transactionId": "<transaction-id>",
1216
+ "status": "completed",
1217
+ "consumerGroup": "worker-group-1"
1218
+ }'
1219
+ ```
1220
+
1221
+ ---
1222
+
1223
+ **Last Updated:** October 15, 2025
1224
+ **API Version:** v1
1225
+ **Server Version:** Queen Message Queue
1226
+