queen-mq 0.1.0 → 0.1.2

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 (160) hide show
  1. package/API.md +862 -752
  2. package/AUTH.md +2044 -0
  3. package/LICENSE.md +202 -0
  4. package/README.md +1705 -1051
  5. package/WEBAPP.md +1889 -0
  6. package/assets/dashboard-01.png +0 -0
  7. package/assets/queen-logo-blue.svg +210 -0
  8. package/assets/queen-logo-cyan.svg +210 -0
  9. package/assets/queen-logo-indigo.svg +210 -0
  10. package/assets/queen-logo-orange.svg +210 -0
  11. package/assets/queen-logo-pink.svg +210 -0
  12. package/assets/queen-logo-purple.svg +210 -0
  13. package/assets/queen-logo-rose.svg +239 -0
  14. package/assets/queen-logo.svg +263 -0
  15. package/examples/batch-processing.js +58 -0
  16. package/examples/test-complete-client.js +260 -0
  17. package/examples/test-dashboard-api.js +200 -0
  18. package/examples/test-traceid.js +147 -0
  19. package/package.json +17 -4
  20. package/server.log +1 -0
  21. package/src/benchmark/consumer.js +207 -0
  22. package/src/benchmark/consumer_multi.js +216 -0
  23. package/src/benchmark/producer.js +75 -0
  24. package/src/benchmark/producer_multi.js +115 -0
  25. package/src/client/client.js +300 -31
  26. package/src/client/queenClient.js +5 -0
  27. package/src/cluster-server.js +242 -0
  28. package/src/config.js +19 -5
  29. package/src/database/connection.js +42 -16
  30. package/src/database/poolManager.js +7 -0
  31. package/src/database/schema-v2.sql +194 -130
  32. package/src/managers/queueManagerOptimized.js +823 -933
  33. package/src/managers/systemEventManager.js +8 -3
  34. package/src/routes/messages.js +127 -57
  35. package/src/routes/pop.js +27 -43
  36. package/src/routes/resources.js +61 -27
  37. package/src/routes/status.js +1037 -0
  38. package/src/server.js +308 -272
  39. package/src/services/evictionService.js +57 -28
  40. package/src/services/retentionService.js +44 -11
  41. package/src/test/MIGRATION_ISSUES.md +174 -0
  42. package/src/test/README.md +203 -0
  43. package/src/test/advanced-pattern-tests.js +1137 -0
  44. package/src/test/bus-mode-tests.js +361 -0
  45. package/src/test/core-tests.js +342 -0
  46. package/src/test/edge-case-tests.js +561 -0
  47. package/src/test/enterprise-tests.js +637 -0
  48. package/src/test/partition-locking-tests.js +545 -0
  49. package/src/test/test-new.js +278 -0
  50. package/src/test/test.js +6 -3
  51. package/src/test/utils.js +169 -0
  52. package/src/utils/streaming.js +231 -0
  53. package/src/utils/uuid.js +2 -2
  54. package/src/websocket/wsServer.js +10 -3
  55. package/test-keepalive-v2.sh +22 -0
  56. package/webapp/COLOR_GUIDE.md +118 -0
  57. package/webapp/README.md +143 -0
  58. package/webapp/index.html +14 -0
  59. package/webapp/package-lock.json +3184 -0
  60. package/webapp/package.json +25 -0
  61. package/webapp/postcss.config.js +7 -0
  62. package/webapp/public/assets/queen-logo-blue.svg +210 -0
  63. package/webapp/public/assets/queen-logo-cyan.svg +210 -0
  64. package/webapp/public/assets/queen-logo-indigo.svg +210 -0
  65. package/webapp/public/assets/queen-logo-orange.svg +210 -0
  66. package/webapp/public/assets/queen-logo-pink.svg +210 -0
  67. package/webapp/public/assets/queen-logo-purple.svg +210 -0
  68. package/webapp/public/assets/queen-logo-rose.svg +239 -0
  69. package/webapp/public/assets/queen-logo.svg +263 -0
  70. package/webapp/src/App.vue +19 -0
  71. package/webapp/src/api/analytics.js +10 -0
  72. package/webapp/src/api/client.js +29 -0
  73. package/webapp/src/api/consumers.js +52 -0
  74. package/webapp/src/api/health.js +7 -0
  75. package/webapp/src/api/messages.js +26 -0
  76. package/webapp/src/api/queues.js +14 -0
  77. package/webapp/src/api/resources.js +8 -0
  78. package/webapp/src/assets/styles/main.css +357 -0
  79. package/webapp/src/components/analytics/AnalyticsFilters.vue +87 -0
  80. package/webapp/src/components/analytics/AnalyticsMetrics.vue +57 -0
  81. package/webapp/src/components/analytics/MessageDistributionChart.vue +111 -0
  82. package/webapp/src/components/analytics/MessageFlowChart.vue +173 -0
  83. package/webapp/src/components/analytics/TimeRangeSelector.vue +27 -0
  84. package/webapp/src/components/analytics/TopQueuesChart.vue +132 -0
  85. package/webapp/src/components/common/ConfirmDialog.vue +56 -0
  86. package/webapp/src/components/common/LoadingSpinner.vue +6 -0
  87. package/webapp/src/components/common/MetricCard.vue +43 -0
  88. package/webapp/src/components/common/StatusBadge.vue +45 -0
  89. package/webapp/src/components/dashboard/MessageStatusCard.vue +50 -0
  90. package/webapp/src/components/dashboard/PerformanceCard.vue +38 -0
  91. package/webapp/src/components/dashboard/ThroughputChart.vue +182 -0
  92. package/webapp/src/components/dashboard/TopQueuesTable.vue +53 -0
  93. package/webapp/src/components/layout/AppLayout.vue +110 -0
  94. package/webapp/src/components/layout/AppSidebar.vue +304 -0
  95. package/webapp/src/components/messages/MessageDetailPanel.vue +242 -0
  96. package/webapp/src/components/messages/MessageFilters.vue +114 -0
  97. package/webapp/src/components/queue-detail/PartitionList.vue +79 -0
  98. package/webapp/src/components/queue-detail/PushMessageModal.vue +175 -0
  99. package/webapp/src/components/queue-detail/QueueConfig.vue +63 -0
  100. package/webapp/src/components/queue-detail/QueueDetailHeader.vue +53 -0
  101. package/webapp/src/components/queue-detail/RecentMessages.vue +76 -0
  102. package/webapp/src/components/queues/CreateQueueModal.vue +193 -0
  103. package/webapp/src/components/queues/QueueFilters.vue +90 -0
  104. package/webapp/src/composables/useApi.js +34 -0
  105. package/webapp/src/composables/useTheme.js +36 -0
  106. package/webapp/src/main.js +11 -0
  107. package/webapp/src/router/index.js +42 -0
  108. package/webapp/src/utils/colors.js +96 -0
  109. package/webapp/src/utils/formatters.js +49 -0
  110. package/webapp/src/views/Analytics.vue +377 -0
  111. package/webapp/src/views/ConsumerGroups.vue +433 -0
  112. package/webapp/src/views/Dashboard.vue +418 -0
  113. package/webapp/src/views/Messages.vue +361 -0
  114. package/webapp/src/views/QueueDetail.vue +582 -0
  115. package/webapp/src/views/Queues.vue +496 -0
  116. package/webapp/tailwind.config.js +25 -0
  117. package/webapp/vite.config.js +10 -0
  118. package/CACHE.md +0 -519
  119. package/DASHBOARD-V3.md +0 -478
  120. package/DASHBOARD.md +0 -382
  121. package/MOD_QUEUE.md +0 -453
  122. package/PARTITION_LOCKING_DESIGN.md +0 -989
  123. package/PLAN.md +0 -707
  124. package/QUERY_ANALSYS.md +0 -72
  125. package/QUEUE_BUS.md +0 -334
  126. package/V2-PLAN.md +0 -236
  127. package/dashboard/.vscode/extensions.json +0 -3
  128. package/dashboard/README.md +0 -5
  129. package/dashboard/index.html +0 -14
  130. package/dashboard/package-lock.json +0 -1458
  131. package/dashboard/package.json +0 -25
  132. package/dashboard/public/vite.svg +0 -1
  133. package/dashboard/src/App.vue +0 -29
  134. package/dashboard/src/assets/styles/main.css +0 -908
  135. package/dashboard/src/assets/vue.svg +0 -1
  136. package/dashboard/src/components/cards/MetricCard.vue +0 -298
  137. package/dashboard/src/components/charts/QueueDepthChart.vue +0 -276
  138. package/dashboard/src/components/charts/QueueLagChart.vue +0 -436
  139. package/dashboard/src/components/charts/ThroughputChart.vue +0 -302
  140. package/dashboard/src/components/common/ActivityFeed.vue +0 -251
  141. package/dashboard/src/components/layout/AppHeader.vue +0 -208
  142. package/dashboard/src/components/layout/AppLayout.vue +0 -88
  143. package/dashboard/src/components/layout/AppSidebar.vue +0 -261
  144. package/dashboard/src/main.js +0 -44
  145. package/dashboard/src/router.js +0 -54
  146. package/dashboard/src/services/api.js +0 -187
  147. package/dashboard/src/services/websocket.js +0 -167
  148. package/dashboard/src/utils/constants.js +0 -56
  149. package/dashboard/src/utils/helpers.js +0 -118
  150. package/dashboard/src/views/Analytics.vue +0 -912
  151. package/dashboard/src/views/Dashboard.vue +0 -906
  152. package/dashboard/src/views/Messages.vue +0 -437
  153. package/dashboard/src/views/QueueDetail.vue +0 -501
  154. package/dashboard/src/views/Queues.vue +0 -333
  155. package/dashboard/vite.config.js +0 -30
  156. package/debug-namespace.js +0 -110
  157. package/docs/long-polling.md +0 -159
  158. package/docs/multi-server-cache-solutions.md +0 -185
  159. package/docs/performance-tuning.md +0 -222
  160. package/src/routes/analytics.js +0 -812
package/API.md CHANGED
@@ -1,1056 +1,1108 @@
1
- # Queen V2 API Documentation
1
+ # Queen Message Queue - API Documentation
2
2
 
3
- ## Overview
3
+ **Base URL:** `http://localhost:6632`
4
4
 
5
- Queen V2 is a high-performance message queue system with a two-tier architecture:
6
- - **Queues**: Top-level organizational units
7
- - **Partitions**: Subdivisions within queues where FIFO ordering is maintained
5
+ **API Version:** v1
8
6
 
9
- Base URL: `http://localhost:6632/api/v1`
10
-
11
- ## Core Concepts
12
-
13
- ### Message Flow
14
- 1. Messages are **pushed** to a queue (optionally specifying a partition)
15
- 2. Messages are **popped** from either a specific partition or any partition in a queue
16
- 3. Messages must be **acknowledged** after processing (completed or failed)
17
-
18
- ### Partitions
19
- - Every queue automatically has a "Default" partition
20
- - Additional partitions can be created by pushing messages to them
21
- - FIFO ordering is maintained within each partition
22
- - Messages without a specified partition go to "Default"
23
-
24
- ### Optional Grouping
25
- - Queues can have optional `namespace` and `task` fields for logical grouping
26
- - These don't affect the hierarchy but allow filtering operations
7
+ **Date:** October 15, 2025
27
8
 
28
9
  ---
29
10
 
30
- ## API Endpoints
11
+ ## Table of Contents
31
12
 
32
- ### 1. Push Messages
33
- **Endpoint:** `POST /api/v1/push`
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)
34
20
 
35
- Adds one or more messages to queues.
21
+ ---
36
22
 
37
- **Request Body:**
38
- ```json
39
- {
40
- "items": [
41
- {
42
- "queue": "email-queue", // Required: queue name
43
- "partition": "urgent", // Optional: defaults to "Default"
44
- "payload": { // Required: message data (JSON)
45
- "to": "user@example.com",
46
- "subject": "Hello"
47
- },
48
- "transactionId": "uuid-here" // Optional: idempotency key
49
- }
50
- ]
51
- }
52
- ```
23
+ ## Authentication
53
24
 
54
- **Response:**
55
- ```json
56
- {
57
- "messages": [
58
- {
59
- "id": "018e63b7-6165-453f-88ae-56effa177605",
60
- "transactionId": "4dfb0478-655b-4c91-bcd9-b7acacf0400f",
61
- "status": "queued" // or "duplicate" if transactionId exists
62
- }
63
- ]
64
- }
65
- ```
25
+ Currently, the Queen API does not require authentication. All endpoints are publicly accessible. CORS is enabled with the following headers:
66
26
 
67
- **Notes:**
68
- - Supports batch operations (up to 1000 messages)
69
- - Automatic duplicate detection via transactionId
70
- - Creates queue/partition if they don't exist
27
+ - `Access-Control-Allow-Origin`: `*`
28
+ - `Access-Control-Allow-Methods`: `GET, POST, PUT, DELETE, OPTIONS`
29
+ - `Access-Control-Allow-Headers`: `Content-Type, Authorization`
71
30
 
72
31
  ---
73
32
 
74
- ### 2. Pop Messages
33
+ ## Health & Monitoring
75
34
 
76
- #### 2.1 Pop from Specific Partition
77
- **Endpoint:** `GET /api/v1/pop/queue/:queue/partition/:partition`
35
+ ### GET /health
78
36
 
79
- Retrieves messages from a specific partition.
37
+ **Purpose:** Check server health and get basic performance statistics.
80
38
 
81
- **Query Parameters:**
82
- - `batch` (integer): Number of messages to retrieve (default: 1)
83
- - `wait` (boolean): Enable long polling (default: false)
84
- - `timeout` (integer): Long polling timeout in ms (default: 30000, max: 60000)
39
+ **Authentication:** None
85
40
 
86
- **Example:**
87
- ```
88
- GET /api/v1/pop/queue/emails/partition/urgent?batch=5&wait=true
89
- ```
41
+ **Query Parameters:** None
90
42
 
91
43
  **Response:**
92
44
  ```json
93
45
  {
94
- "messages": [
95
- {
96
- "id": "message-uuid",
97
- "transactionId": "transaction-uuid",
98
- "queue": "emails",
99
- "partition": "urgent",
100
- "data": { "to": "user@example.com", "subject": "Alert" },
101
- "retryCount": 0,
102
- "priority": 0,
103
- "createdAt": "2025-10-08T05:12:33.893Z",
104
- "lockedAt": null,
105
- "options": { "leaseTime": 300, "retryLimit": 3 }
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
106
58
  }
107
- ]
59
+ }
108
60
  }
109
61
  ```
110
62
 
111
- #### 2.2 Pop from Any Partition in Queue
112
- **Endpoint:** `GET /api/v1/pop/queue/:queue`
113
-
114
- Retrieves messages from any available partition in the queue (oldest first).
63
+ **Status Codes:**
64
+ - `200`: Server is healthy
65
+ - `503`: Server is unhealthy
115
66
 
116
- **Query Parameters:** Same as above
67
+ ---
117
68
 
118
- **Example:**
119
- ```
120
- GET /api/v1/pop/queue/emails?batch=10
121
- ```
69
+ ### GET /metrics
122
70
 
123
- #### 2.3 Pop with Filters
124
- **Endpoint:** `GET /api/v1/pop`
71
+ **Purpose:** Get detailed performance metrics for monitoring and observability.
125
72
 
126
- Retrieves messages from queues matching namespace or task filters.
73
+ **Authentication:** None
127
74
 
128
- **Query Parameters:**
129
- - `namespace` (string): Filter by namespace
130
- - `task` (string): Filter by task
131
- - `batch`, `wait`, `timeout`: Same as above
75
+ **Query Parameters:** None
132
76
 
133
- **Example:**
134
- ```
135
- GET /api/v1/pop?namespace=production&batch=5
136
- GET /api/v1/pop?task=billing&wait=true
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
+ }
137
106
  ```
138
107
 
139
- **Response Format:** Same as above
140
-
141
108
  **Status Codes:**
142
- - `200`: Messages retrieved successfully
143
- - `204`: No messages available (empty response)
109
+ - `200`: Success
144
110
 
145
111
  ---
146
112
 
147
- ### 3. Acknowledge Messages
113
+ ## Queue Management
148
114
 
149
- #### 3.1 Single Acknowledgment
150
- **Endpoint:** `POST /api/v1/ack`
115
+ ### POST /api/v1/configure
151
116
 
152
- Acknowledges a single message as completed or failed.
117
+ **Purpose:** Create or configure a queue with specific settings and partitions.
118
+
119
+ **Authentication:** None
153
120
 
154
121
  **Request Body:**
155
122
  ```json
156
123
  {
157
- "transactionId": "4dfb0478-655b-4c91-bcd9-b7acacf0400f",
158
- "status": "completed", // or "failed"
159
- "error": "Error message if failed" // Optional
124
+ "queue": "test-queue",
125
+ "partition": "Default",
126
+ "ttl": 300,
127
+ "priority": 1,
128
+ "maxQueueSize": 1000
160
129
  }
161
130
  ```
162
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
+
163
142
  **Response:**
164
143
  ```json
165
144
  {
166
- "transactionId": "4dfb0478-655b-4c91-bcd9-b7acacf0400f",
167
- "status": "completed",
168
- "acknowledgedAt": "2025-10-08T07:12:47.353Z"
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."
169
166
  }
170
167
  ```
171
168
 
172
- #### 3.2 Batch Acknowledgment
173
- **Endpoint:** `POST /api/v1/ack/batch`
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
174
179
 
175
- Acknowledges multiple messages at once.
180
+ **Purpose:** Push one or more messages to a queue.
181
+
182
+ **Authentication:** None
176
183
 
177
184
  **Request Body:**
178
185
  ```json
179
186
  {
180
- "acknowledgments": [
181
- {
182
- "transactionId": "uuid-1",
183
- "status": "completed"
184
- },
187
+ "items": [
185
188
  {
186
- "transactionId": "uuid-2",
187
- "status": "failed",
188
- "error": "Processing error"
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"
189
197
  }
190
198
  ]
191
199
  }
192
200
  ```
193
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
+
194
211
  **Response:**
195
212
  ```json
196
213
  {
197
- "processed": 2,
198
- "results": [
199
- { "transactionId": "uuid-1", "status": "completed" },
200
- { "transactionId": "uuid-2", "status": "retry_scheduled", "retryCount": 1 }
214
+ "messages": [
215
+ {
216
+ "id": "0199e688-1857-7462-81ea-b87975de7e95",
217
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde",
218
+ "traceId": null,
219
+ "status": "queued"
220
+ }
201
221
  ]
202
222
  }
203
223
  ```
204
224
 
205
- **Notes:**
206
- - Failed messages are automatically retried based on partition's `retryLimit`
207
- - After max retries, messages can be moved to dead letter queue
225
+ **Status Codes:**
226
+ - `201`: Messages pushed successfully
227
+ - `400`: Invalid request body
228
+ - `500`: Internal server error
208
229
 
209
230
  ---
210
231
 
211
- ### 4. Configure Queue
212
- **Endpoint:** `POST /api/v1/configure`
232
+ ### GET /api/v1/pop/queue/:queue/partition/:partition
213
233
 
214
- Configures options for a queue. All configuration is now at the queue level - partitions are simple FIFO containers.
234
+ **Purpose:** Pop messages from a specific queue and partition.
215
235
 
216
- **Request Body:**
217
- ```json
218
- {
219
- "queue": "notifications",
220
- "partition": "critical", // DEPRECATED: Ignored but accepted for backward compatibility
221
- "options": {
222
- "leaseTime": 600, // Seconds before message lease expires
223
- "retryLimit": 5, // Max retry attempts
224
- "priority": 10, // Queue priority (higher = processed first)
225
- "maxSize": 10000, // Max messages in queue
226
- "ttl": 3600, // Time to live in seconds
227
- "dlqAfterMaxRetries": true, // Move to DLQ after max retries
228
- "delayedProcessing": 0, // Delay before messages are available (seconds)
229
- "windowBuffer": 0, // Buffer window for message processing (seconds)
230
- "retentionSeconds": 0, // Auto-delete pending messages after X seconds
231
- "completedRetentionSeconds": 0, // Auto-delete completed messages after X seconds
232
- "retentionEnabled": false, // Enable retention policies
233
- "encryptionEnabled": false, // Enable message encryption
234
- "maxWaitTimeSeconds": 0 // Max wait time for long polling
235
- }
236
- }
237
- ```
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
238
249
 
239
250
  **Response:**
240
251
  ```json
241
252
  {
242
- "queue": "notifications",
243
- "configured": true,
244
- "options": { /* all options with defaults filled */ }
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
+ ]
245
272
  }
246
273
  ```
247
274
 
248
- **Note:** The `partition` parameter in the request is deprecated and ignored. All configuration now applies to the entire queue.
275
+ **Status Codes:**
276
+ - `200`: Messages retrieved successfully
277
+ - `204`: No messages available
278
+ - `500`: Internal server error
249
279
 
250
280
  ---
251
281
 
252
- ### 5. Analytics & Monitoring
282
+ ### GET /api/v1/pop/queue/:queue
253
283
 
254
- #### 5.1 Queue Statistics
255
- **Endpoint:** `GET /api/v1/analytics/queue/:queue`
284
+ **Purpose:** Pop messages from a queue (any partition).
256
285
 
257
- Gets detailed statistics for a specific queue.
286
+ **Authentication:** None
258
287
 
259
- **Response:**
260
- ```json
261
- {
262
- "queue": "emails",
263
- "namespace": null,
264
- "task": null,
265
- "totals": {
266
- "pending": 10,
267
- "processing": 5,
268
- "completed": 100,
269
- "failed": 2,
270
- "deadLetter": 1,
271
- "total": 118
272
- },
273
- "partitions": [
274
- {
275
- "name": "Default",
276
- "stats": {
277
- "pending": 8,
278
- "processing": 3,
279
- "completed": 80,
280
- "failed": 1,
281
- "deadLetter": 0,
282
- "total": 92
283
- }
284
- },
285
- {
286
- "name": "urgent",
287
- "stats": {
288
- "pending": 2,
289
- "processing": 2,
290
- "completed": 20,
291
- "failed": 1,
292
- "deadLetter": 1,
293
- "total": 26
294
- }
295
- }
296
- ]
297
- }
298
- ```
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`
299
294
 
300
- #### 5.2 All Queues Overview
301
- **Endpoint:** `GET /api/v1/analytics/queues`
295
+ **Status Codes:**
296
+ - `200`: Messages retrieved successfully
297
+ - `204`: No messages available
298
+ - `500`: Internal server error
299
+
300
+ ---
302
301
 
303
- Gets statistics for all queues in the system.
302
+ ### GET /api/v1/pop
303
+
304
+ **Purpose:** Pop messages from queues filtered by namespace or task.
305
+
306
+ **Authentication:** None
304
307
 
305
308
  **Query Parameters:**
306
- - `namespace` (string): Filter by namespace
307
- - `task` (string): Filter by task
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
308
315
 
309
- **Response:**
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:**
310
332
  ```json
311
333
  {
312
- "queues": [
313
- {
314
- "queue": "emails",
315
- "namespace": "production",
316
- "task": "notifications",
317
- "partitions": [...],
318
- "totals": {...}
319
- }
320
- ]
334
+ "transactionId": "0199e688-4d29-7019-bf32-5d4f21306b35",
335
+ "status": "completed",
336
+ "error": "optional error message if failed"
321
337
  }
322
338
  ```
323
339
 
324
- #### 5.3 Queue Depths
325
- **Endpoint:** `GET /api/v1/analytics/queue-depths`
326
-
327
- Gets pending message counts for all queues.
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
328
345
 
329
346
  **Response:**
330
347
  ```json
331
348
  {
332
- "depths": [
333
- {
334
- "queue": "emails",
335
- "depth": 10, // Total pending
336
- "processing": 5, // Total processing
337
- "partitions": [
338
- { "name": "Default", "depth": 8, "processing": 3 },
339
- { "name": "urgent", "depth": 2, "processing": 2 }
340
- ]
341
- }
342
- ]
349
+ "status": "completed",
350
+ "consumerGroup": null,
351
+ "acknowledgedAt": "2025-10-15T06:22:02.382Z"
343
352
  }
344
353
  ```
345
354
 
346
- #### 5.4 Throughput Metrics
347
- **Endpoint:** `GET /api/v1/analytics/throughput`
355
+ **Status Codes:**
356
+ - `200`: Acknowledgment successful
357
+ - `400`: Invalid request body
358
+ - `500`: Internal server error
348
359
 
349
- Gets throughput metrics over the last hour (minute-by-minute).
360
+ ---
350
361
 
351
- **Response:**
362
+ ### POST /api/v1/ack/batch
363
+
364
+ **Purpose:** Acknowledge multiple messages in a single request.
365
+
366
+ **Authentication:** None
367
+
368
+ **Request Body:**
352
369
  ```json
353
370
  {
354
- "throughput": [
371
+ "acknowledgments": [
355
372
  {
356
- "timestamp": "2025-10-08T07:00:00.000Z",
357
- "incoming": {
358
- "messagesPerMinute": 120,
359
- "messagesPerSecond": 2
360
- },
361
- "completed": {
362
- "messagesPerMinute": 115,
363
- "messagesPerSecond": 1
364
- },
365
- "processing": {
366
- "messagesPerMinute": 100,
367
- "messagesPerSecond": 1
368
- },
369
- "failed": {
370
- "messagesPerMinute": 5,
371
- "messagesPerSecond": 0
372
- },
373
- "lag": {
374
- "avgSeconds": 2.5,
375
- "avgMilliseconds": 2500,
376
- "sampleCount": 115
377
- }
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"
378
380
  }
379
- // ... 59 more entries
380
- ]
381
+ ],
382
+ "consumerGroup": "optional-consumer-group"
381
383
  }
382
384
  ```
383
385
 
384
- #### 5.5 Queue Lag Analysis
385
- **Endpoint:** `GET /api/v1/analytics/queue-lag`
386
-
387
- Gets queue lag metrics based on processing times and current backlog.
388
-
389
- **Query Parameters:**
390
- - `queue` (string): Filter by queue name
391
- - `namespace` (string): Filter by namespace
392
- - `task` (string): Filter by task
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
393
392
 
394
393
  **Response:**
395
394
  ```json
396
395
  {
397
- "queues": [
396
+ "processed": 2,
397
+ "results": [
398
398
  {
399
- "queue": "emails",
400
- "namespace": "production",
401
- "task": "notifications",
402
- "partitions": [
403
- {
404
- "name": "Default",
405
- "stats": {
406
- "pendingCount": 150,
407
- "processingCount": 25,
408
- "totalBacklog": 175,
409
- "completedMessages": 1250,
410
- "avgProcessingTimeSeconds": 2.5,
411
- "medianProcessingTimeSeconds": 2.1,
412
- "p95ProcessingTimeSeconds": 4.8,
413
- "estimatedLagSeconds": 437.5,
414
- "medianLagSeconds": 367.5,
415
- "p95LagSeconds": 840.0,
416
- "estimatedLag": "7m 17s",
417
- "medianLag": "6m 7s",
418
- "p95Lag": "14m 0s",
419
- "avgProcessingTime": "2.5s",
420
- "medianProcessingTime": "2.1s",
421
- "p95ProcessingTime": "4.8s"
422
- }
423
- }
424
- ],
425
- "totals": {
426
- "pendingCount": 150,
427
- "processingCount": 25,
428
- "totalBacklog": 175,
429
- "completedMessages": 1250,
430
- "avgProcessingTimeSeconds": 2.5,
431
- "medianProcessingTimeSeconds": 2.1,
432
- "p95ProcessingTimeSeconds": 4.8,
433
- "estimatedLagSeconds": 437.5,
434
- "medianLagSeconds": 367.5,
435
- "p95LagSeconds": 840.0,
436
- "estimatedLag": "7m 17s",
437
- "medianLag": "6m 7s",
438
- "p95Lag": "14m 0s",
439
- "avgProcessingTime": "2.5s",
440
- "medianProcessingTime": "2.1s",
441
- "p95ProcessingTime": "4.8s"
442
- }
399
+ "transactionId": "0199e688-6c45-769d-921b-527ee7c3d57c",
400
+ "status": "completed"
401
+ },
402
+ {
403
+ "transactionId": "0199e688-6c45-769d-921b-55f611d0cd5a",
404
+ "status": "failed_dlq"
443
405
  }
444
406
  ]
445
407
  }
446
408
  ```
447
409
 
448
- **Lag Calculation:**
449
- - **Estimated Lag**: `(pending + processing) × average_processing_time`
450
- - **Median Lag**: `(pending + processing) × median_processing_time`
451
- - **95th Percentile Lag**: `(pending + processing) × p95_processing_time`
410
+ **Status Codes:**
411
+ - `200`: Batch acknowledgment successful
412
+ - `400`: Invalid request body
413
+ - `500`: Internal server error
452
414
 
453
- **Notes:**
454
- - Only includes queues with at least 5 completed messages in the last 24 hours
455
- - Processing times are calculated from `completed_at - created_at` for completed messages
456
- - Lag represents the estimated time for all current backlog to be processed
415
+ ---
457
416
 
458
- #### 5.6 Queue-Specific Stats
459
- **Endpoint:** `GET /api/v1/analytics/queue-stats`
417
+ ### GET /api/v1/messages
460
418
 
461
- Gets statistics with flexible filtering.
419
+ **Purpose:** List messages with optional filters.
420
+
421
+ **Authentication:** None
462
422
 
463
423
  **Query Parameters:**
464
- - `queue` (string): Filter by queue name
465
- - `namespace` (string): Filter by namespace
466
- - `task` (string): Filter by task
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)
467
430
 
468
- **Example:**
469
- ```
470
- GET /api/v1/analytics/queue-stats?queue=emails
471
- GET /api/v1/analytics/queue-stats?namespace=production
431
+ **Response:**
432
+ ```json
433
+ {
434
+ "messages": []
435
+ }
472
436
  ```
473
437
 
474
- #### 5.6 Filtered Analytics
475
- **Endpoint:** `GET /api/v1/analytics`
476
-
477
- Gets analytics based on namespace or task filters.
438
+ **Note:** This endpoint currently has a database schema issue (`column m.status does not exist`).
478
439
 
479
- **Query Parameters:**
480
- - `namespace` (string): Get all queues in namespace
481
- - `task` (string): Get all queues with task
440
+ **Status Codes:**
441
+ - `200`: Success
442
+ - `500`: Internal server error
482
443
 
483
444
  ---
484
445
 
485
- ### 6. Message Management
446
+ ### GET /api/v1/messages/:transactionId
486
447
 
487
- #### 6.1 List Messages
488
- **Endpoint:** `GET /api/v1/messages`
448
+ **Purpose:** Get details of a specific message by transaction ID.
489
449
 
490
- Lists messages with filtering options.
450
+ **Authentication:** None
491
451
 
492
- **Query Parameters:**
493
- - `queue` (string): Filter by queue name
494
- - `partition` (string): Filter by partition name
495
- - `namespace` (string): Filter by namespace
496
- - `task` (string): Filter by task
497
- - `status` (string): Filter by status (pending, processing, completed, failed, dead_letter)
498
- - `limit` (integer): Max results (default: 100)
499
- - `offset` (integer): Pagination offset (default: 0)
452
+ **Path Parameters:**
453
+ - `transactionId` (string): Message transaction ID
500
454
 
501
455
  **Response:**
502
456
  ```json
503
457
  {
504
- "messages": [
505
- {
506
- "id": "message-uuid",
507
- "transactionId": "transaction-uuid",
508
- "queuePath": "emails/urgent",
509
- "queue": "emails",
510
- "partition": "urgent",
511
- "namespace": null,
512
- "task": null,
513
- "payload": {...},
514
- "status": "pending",
515
- "workerId": null,
516
- "createdAt": "2025-10-08T05:12:33.889Z",
517
- "lockedAt": null,
518
- "completedAt": null,
519
- "failedAt": null,
520
- "errorMessage": null,
521
- "retryCount": 0,
522
- "leaseExpiresAt": null
523
- }
524
- ]
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
+ }
525
476
  }
526
477
  ```
527
478
 
528
- #### 6.2 Get Single Message
529
- **Endpoint:** `GET /api/v1/messages/:transactionId`
479
+ **Status Codes:**
480
+ - `200`: Message found
481
+ - `404`: Message not found
482
+ - `500`: Internal server error
483
+
484
+ ---
530
485
 
531
- Gets details of a specific message.
486
+ ### DELETE /api/v1/messages/:transactionId
532
487
 
533
- **Response:** Single message object with partition options included
488
+ **Purpose:** Delete a specific message by transaction ID.
534
489
 
535
- #### 6.3 Delete Message
536
- **Endpoint:** `DELETE /api/v1/messages/:transactionId`
490
+ **Authentication:** None
537
491
 
538
- Permanently deletes a message.
492
+ **Path Parameters:**
493
+ - `transactionId` (string): Message transaction ID
539
494
 
540
495
  **Response:**
541
496
  ```json
542
497
  {
543
498
  "deleted": true,
544
- "transactionId": "transaction-uuid"
499
+ "transactionId": "0199e688-1857-7462-81ea-b4fe7532bbde"
545
500
  }
546
501
  ```
547
502
 
548
- #### 6.4 Retry Failed Message
549
- **Endpoint:** `POST /api/v1/messages/:transactionId/retry`
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
550
511
 
551
- Resets a failed message to pending for retry.
512
+ **Purpose:** Retry a failed message.
513
+
514
+ **Authentication:** None
515
+
516
+ **Path Parameters:**
517
+ - `transactionId` (string): Message transaction ID
552
518
 
553
519
  **Response:**
554
520
  ```json
555
521
  {
556
522
  "retried": true,
557
- "transactionId": "transaction-uuid"
523
+ "transactionId": "0199e688-a908-726e-9ca2-a2a9b312684d"
558
524
  }
559
525
  ```
560
526
 
561
- #### 6.5 Move to Dead Letter Queue
562
- **Endpoint:** `POST /api/v1/messages/:transactionId/dlq`
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.
563
536
 
564
- Moves a failed message to the dead letter queue.
537
+ **Authentication:** None
538
+
539
+ **Path Parameters:**
540
+ - `transactionId` (string): Message transaction ID
565
541
 
566
542
  **Response:**
567
543
  ```json
568
544
  {
569
545
  "movedToDLQ": true,
570
- "transactionId": "transaction-uuid"
546
+ "transactionId": "0199e688-a908-726e-9ca2-a2a9b312684d"
571
547
  }
572
548
  ```
573
549
 
574
- #### 6.6 Get Related Messages
575
- **Endpoint:** `GET /api/v1/messages/:transactionId/related`
550
+ **Status Codes:**
551
+ - `200`: Message moved to DLQ
552
+ - `500`: Internal server error
576
553
 
577
- Gets messages from the same partition within 1 hour of the specified message.
554
+ ---
578
555
 
579
- **Response:**
580
- ```json
581
- {
582
- "messages": [
583
- {
584
- "transactionId": "related-uuid",
585
- "status": "completed",
586
- "createdAt": "2025-10-08T05:10:00.000Z",
587
- "payload": {...}
588
- }
589
- ]
590
- }
591
- ```
556
+ ### GET /api/v1/messages/:transactionId/related
592
557
 
593
- #### 6.7 Clear Queue
594
- **Endpoint:** `DELETE /api/v1/queues/:queue/clear`
558
+ **Purpose:** Get messages related to a specific message (e.g., by trace ID).
595
559
 
596
- Deletes all messages from a queue or specific partition.
560
+ **Authentication:** None
597
561
 
598
- **Query Parameters:**
599
- - `partition` (string): Clear specific partition only
562
+ **Path Parameters:**
563
+ - `transactionId` (string): Message transaction ID
600
564
 
601
565
  **Response:**
602
566
  ```json
603
567
  {
604
- "cleared": true,
605
- "count": 25,
606
- "queue": "emails",
607
- "partition": "all" // or specific partition name
568
+ "messages": []
608
569
  }
609
570
  ```
610
571
 
611
- ---
572
+ **Note:** This endpoint currently has a database schema issue.
612
573
 
613
- ### 7. System Health & Metrics
574
+ **Status Codes:**
575
+ - `200`: Success
576
+ - `500`: Internal server error
614
577
 
615
- #### 7.1 Health Check
616
- **Endpoint:** `GET /health`
578
+ ---
617
579
 
618
- Checks system health and basic statistics.
580
+ ### DELETE /api/v1/queues/:queue/clear
619
581
 
620
- **Response:**
621
- ```json
622
- {
623
- "status": "healthy",
624
- "uptime": "3600s",
625
- "connections": 5,
626
- "stats": {
627
- "requests": 1000,
628
- "messages": 5000,
629
- "requestsPerSecond": "0.28",
630
- "messagesPerSecond": "1.39",
631
- "pool": {
632
- "total": 20,
633
- "idle": 15,
634
- "waiting": 0
635
- }
636
- }
637
- }
638
- ```
582
+ **Purpose:** Clear all messages from a queue or specific partition.
639
583
 
640
- #### 7.2 Detailed Metrics
641
- **Endpoint:** `GET /metrics`
584
+ **Authentication:** None
642
585
 
643
- Gets detailed performance metrics.
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)
644
591
 
645
592
  **Response:**
646
593
  ```json
647
594
  {
648
- "uptime": 3600,
649
- "requests": {
650
- "total": 1000,
651
- "rate": 0.28
652
- },
653
- "messages": {
654
- "total": 5000,
655
- "rate": 1.39
656
- },
657
- "database": {
658
- "poolSize": 20,
659
- "idleConnections": 15,
660
- "waitingRequests": 0
661
- },
662
- "memory": {
663
- "rss": 104857600,
664
- "heapTotal": 73728000,
665
- "heapUsed": 45678900,
666
- "external": 2345678,
667
- "arrayBuffers": 123456
668
- },
669
- "cpu": {
670
- "user": 1234567,
671
- "system": 234567
672
- }
595
+ "cleared": true,
596
+ "count": 6,
597
+ "queue": "test-queue",
598
+ "partition": "Default"
673
599
  }
674
600
  ```
675
601
 
676
- ---
602
+ **Status Codes:**
603
+ - `200`: Queue cleared
604
+ - `500`: Internal server error
677
605
 
678
- ## Resource Management
606
+ ---
679
607
 
680
- ### 8. Resources API
608
+ ## Resource Queries
681
609
 
682
- These endpoints provide information about queues, partitions, and system structure for frontend displays.
610
+ ### GET /api/v1/resources/queues
683
611
 
684
- #### 8.1 List All Queues
685
- **Endpoint:** `GET /api/v1/resources/queues`
612
+ **Purpose:** Get a list of all queues with their statistics.
686
613
 
687
- Gets all queues with summary information.
614
+ **Authentication:** None
688
615
 
689
616
  **Query Parameters:**
690
- - `namespace` (string): Filter by namespace
691
- - `task` (string): Filter by task
617
+ - `namespace` (string, optional): Filter by namespace
618
+ - `task` (string, optional): Filter by task
692
619
 
693
620
  **Response:**
694
621
  ```json
695
622
  {
696
623
  "queues": [
697
624
  {
698
- "id": "queue-uuid",
699
- "name": "emails",
625
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
626
+ "name": "test-queue",
700
627
  "namespace": null,
701
628
  "task": null,
702
- "createdAt": "2025-10-08T05:13:37.528Z",
703
- "partitions": 3,
629
+ "createdAt": "2025-10-15T06:21:42.034Z",
630
+ "partitions": 1,
704
631
  "messages": {
705
- "total": 100,
706
- "pending": 20,
707
- "processing": 5
632
+ "total": 0,
633
+ "pending": 2,
634
+ "processing": 0
708
635
  }
709
636
  }
710
637
  ]
711
638
  }
712
639
  ```
713
640
 
714
- #### 8.2 Get Queue Details
715
- **Endpoint:** `GET /api/v1/resources/queues/:queue`
641
+ **Status Codes:**
642
+ - `200`: Success
643
+ - `500`: Internal server error
644
+
645
+ ---
646
+
647
+ ### GET /api/v1/resources/queues/:queue
716
648
 
717
- Gets detailed information about a specific queue including all partitions.
649
+ **Purpose:** Get detailed information about a specific queue.
650
+
651
+ **Authentication:** None
652
+
653
+ **Path Parameters:**
654
+ - `queue` (string): Queue name
718
655
 
719
656
  **Response:**
720
657
  ```json
721
658
  {
722
- "id": "queue-uuid",
723
- "name": "emails",
659
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
660
+ "name": "test-queue",
724
661
  "namespace": null,
725
662
  "task": null,
726
- "createdAt": "2025-10-08T05:13:37.528Z",
663
+ "createdAt": "2025-10-15T06:21:42.034Z",
727
664
  "partitions": [
728
665
  {
729
- "id": "partition-uuid",
730
- "name": "urgent",
731
- "priority": 10,
732
- "options": {
733
- "leaseTime": 300,
734
- "retryLimit": 3
735
- },
736
- "createdAt": "2025-10-08T05:13:37.541Z",
666
+ "id": "7a30d768-7eb7-40dd-ade9-8afb20c18591",
667
+ "name": "Default",
668
+ "createdAt": "2025-10-15T06:21:42.865Z",
737
669
  "stats": {
738
- "total": 50,
739
- "pending": 10,
740
- "processing": 2,
741
- "completed": 35,
742
- "failed": 3,
670
+ "total": 0,
671
+ "pending": 2,
672
+ "processing": 0,
673
+ "completed": 3,
674
+ "failed": 0,
743
675
  "deadLetter": 0
744
676
  },
745
- "oldestMessage": "2025-10-08T05:00:00.000Z",
746
- "newestMessage": "2025-10-08T07:30:00.000Z"
677
+ "oldestMessage": null,
678
+ "newestMessage": null
747
679
  }
748
680
  ],
749
681
  "totals": {
750
- "total": 100,
751
- "pending": 20,
752
- "processing": 5,
753
- "completed": 70,
754
- "failed": 5,
682
+ "total": 0,
683
+ "pending": 2,
684
+ "processing": 0,
685
+ "completed": 3,
686
+ "failed": 0,
755
687
  "deadLetter": 0
756
688
  }
757
689
  }
758
690
  ```
759
691
 
760
- #### 8.3 List All Partitions
761
- **Endpoint:** `GET /api/v1/resources/partitions`
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.
762
702
 
763
- Gets all partitions across all queues.
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
764
727
 
765
728
  **Query Parameters:**
766
- - `queue` (string): Filter by queue name
767
- - `minDepth` (integer): Only show partitions with at least this many pending messages
729
+ - `queue` (string, optional): Filter by queue name
730
+ - `minDepth` (number, optional): Filter partitions with at least this many messages
768
731
 
769
732
  **Response:**
770
733
  ```json
771
734
  {
772
735
  "partitions": [
773
736
  {
774
- "id": "partition-uuid",
775
- "name": "urgent",
776
- "queue": "emails",
737
+ "id": "7a30d768-7eb7-40dd-ade9-8afb20c18591",
738
+ "name": "Default",
739
+ "queue": "test-queue",
777
740
  "namespace": null,
778
741
  "task": null,
779
- "priority": 10,
780
- "options": { /* partition options */ },
781
- "createdAt": "2025-10-08T05:13:37.541Z",
782
- "depth": 10,
783
- "processing": 2,
784
- "total": 50
742
+ "queuePriority": 0,
743
+ "createdAt": "2025-10-15T06:21:42.865Z",
744
+ "depth": 2,
745
+ "processing": 0,
746
+ "total": 0
785
747
  }
786
748
  ]
787
749
  }
788
750
  ```
789
751
 
790
- #### 8.4 List Namespaces
791
- **Endpoint:** `GET /api/v1/resources/namespaces`
752
+ **Status Codes:**
753
+ - `200`: Success
754
+ - `500`: Internal server error
792
755
 
793
- Gets all namespaces with aggregated statistics.
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
794
765
 
795
766
  **Response:**
796
767
  ```json
797
768
  {
798
769
  "namespaces": [
799
770
  {
800
- "namespace": "production",
801
- "queues": 5,
802
- "partitions": 15,
771
+ "namespace": "benchmark",
772
+ "queues": 51,
773
+ "partitions": 510,
803
774
  "messages": {
804
- "total": 1000,
805
- "pending": 200
775
+ "total": 200000,
776
+ "pending": 0
806
777
  }
807
778
  }
808
779
  ]
809
780
  }
810
781
  ```
811
782
 
812
- #### 8.5 List Tasks
813
- **Endpoint:** `GET /api/v1/resources/tasks`
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.
814
792
 
815
- Gets all tasks with aggregated statistics.
793
+ **Authentication:** None
794
+
795
+ **Query Parameters:** None
816
796
 
817
797
  **Response:**
818
798
  ```json
819
799
  {
820
- "tasks": [
821
- {
822
- "task": "notifications",
823
- "queues": 3,
824
- "partitions": 9,
825
- "messages": {
826
- "total": 500,
827
- "pending": 100
828
- }
829
- }
830
- ]
800
+ "tasks": []
831
801
  }
832
802
  ```
833
803
 
834
- #### 8.6 System Overview
835
- **Endpoint:** `GET /api/v1/resources/overview`
804
+ **Status Codes:**
805
+ - `200`: Success
806
+ - `500`: Internal server error
807
+
808
+ ---
809
+
810
+ ### GET /api/v1/resources/overview
836
811
 
837
- Gets a complete system overview with all key metrics.
812
+ **Purpose:** Get a comprehensive system overview with all statistics.
813
+
814
+ **Authentication:** None
815
+
816
+ **Query Parameters:** None
838
817
 
839
818
  **Response:**
840
819
  ```json
841
820
  {
842
- "queues": 8,
843
- "partitions": 15,
844
- "namespaces": 2,
845
- "tasks": 3,
821
+ "queues": 53,
822
+ "partitions": 512,
823
+ "namespaces": 1,
824
+ "tasks": 0,
846
825
  "messages": {
847
- "total": 1000,
848
- "pending": 200,
849
- "processing": 50,
850
- "completed": 700,
851
- "failed": 40,
852
- "deadLetter": 10
826
+ "total": 200000,
827
+ "pending": 2,
828
+ "processing": 0,
829
+ "completed": 16493,
830
+ "failed": 0,
831
+ "deadLetter": 0
853
832
  },
854
- "timestamp": "2025-10-08T07:29:35.682Z"
833
+ "timestamp": "2025-10-15T06:22:38.014Z"
855
834
  }
856
835
  ```
857
836
 
837
+ **Status Codes:**
838
+ - `200`: Success
839
+ - `500`: Internal server error
840
+
858
841
  ---
859
842
 
860
- ## WebSocket Support
843
+ ## Status & Analytics
861
844
 
862
- ### Dashboard WebSocket
863
- **Endpoint:** `ws://localhost:6632/ws/dashboard`
845
+ ### GET /api/v1/status
864
846
 
865
- Real-time updates for dashboard monitoring with V2 structure.
847
+ **Purpose:** Get comprehensive dashboard status including throughput metrics and message statistics.
866
848
 
867
- #### Connection
868
- ```javascript
869
- const ws = new WebSocket('ws://localhost:6632/ws/dashboard');
849
+ **Authentication:** None
870
850
 
871
- ws.onopen = () => {
872
- // Send ping to keep alive
873
- setInterval(() => ws.send('ping'), 30000);
874
-
875
- // Optional: Subscribe to specific queues
876
- ws.send(JSON.stringify({
877
- type: 'subscribe',
878
- queues: ['emails', 'payments']
879
- }));
880
- };
881
- ```
882
-
883
- #### Events (Server → Client)
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
884
857
 
885
- **Connection Events:**
858
+ **Response:**
886
859
  ```json
887
860
  {
888
- "event": "connected",
889
- "data": {
890
- "connectionId": "uuid",
891
- "version": "v2"
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
892
888
  },
893
- "timestamp": "2025-10-08T07:30:00.000Z"
889
+ "deadLetterQueue": {
890
+ "totalMessages": 0,
891
+ "affectedPartitions": 0,
892
+ "topErrors": []
893
+ }
894
894
  }
895
895
  ```
896
896
 
897
- **Message Events:**
898
- ```json
899
- // Message pushed
900
- {
901
- "event": "message.pushed",
902
- "data": {
903
- "queue": "emails",
904
- "partition": "urgent",
905
- "transactionId": "uuid"
906
- },
907
- "timestamp": "2025-10-08T07:30:00.000Z"
908
- }
897
+ **Status Codes:**
898
+ - `200`: Success
899
+ - `500`: Internal server error
909
900
 
910
- // Message processing
911
- {
912
- "event": "message.processing",
913
- "data": {
914
- "queue": "emails",
915
- "partition": "urgent",
916
- "transactionId": "uuid",
917
- "workerId": "worker-123"
918
- },
919
- "timestamp": "2025-10-08T07:30:00.000Z"
920
- }
901
+ ---
921
902
 
922
- // Message completed
923
- {
924
- "event": "message.completed",
925
- "data": {
926
- "transactionId": "uuid"
927
- },
928
- "timestamp": "2025-10-08T07:30:00.000Z"
929
- }
903
+ ### GET /api/v1/status/queues
930
904
 
931
- // Message failed
932
- {
933
- "event": "message.failed",
934
- "data": {
935
- "transactionId": "uuid",
936
- "error": "Processing error"
937
- },
938
- "timestamp": "2025-10-08T07:30:00.000Z"
939
- }
940
- ```
905
+ **Purpose:** Get a list of queues with detailed status information.
941
906
 
942
- **Queue Events:**
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:**
943
918
  ```json
944
- // Queue created
945
919
  {
946
- "event": "queue.created",
947
- "data": {
948
- "queue": "new-queue",
949
- "partition": "Default"
950
- },
951
- "timestamp": "2025-10-08T07:30:00.000Z"
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
+ ]
952
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
953
 
954
- // Queue depth update (every 5 seconds)
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
955
965
  {
956
- "event": "queue.depth",
957
- "data": {
958
- "queue": "emails",
966
+ "queue": {
967
+ "id": "03093457-e6f6-4e5f-869b-045a6916fdff",
968
+ "name": "test-queue",
959
969
  "namespace": null,
960
970
  "task": null,
961
- "totalDepth": 25,
962
- "totalProcessing": 5,
963
- "partitions": {
964
- "Default": {
965
- "depth": 10,
966
- "processing": 2,
967
- "completed": 100,
968
- "failed": 5
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
969
1004
  },
970
- "urgent": {
971
- "depth": 15,
972
- "processing": 3,
973
- "completed": 50,
974
- "failed": 2
1005
+ "cursor": {
1006
+ "totalConsumed": 3,
1007
+ "batchesConsumed": 2,
1008
+ "lastConsumedAt": "2025-10-15T06:22:10.537Z"
975
1009
  }
976
1010
  }
977
- },
978
- "timestamp": "2025-10-08T07:30:00.000Z"
979
- }
980
-
981
- // Partition depth update (every 5 seconds)
982
- {
983
- "event": "partition.depth",
984
- "data": {
985
- "queue": "emails",
986
- "partition": "urgent",
987
- "depth": 15,
988
- "processing": 3,
989
- "completed": 50,
990
- "failed": 2,
991
- "total": 70
992
- },
993
- "timestamp": "2025-10-08T07:30:00.000Z"
1011
+ ],
1012
+ "timeRange": {
1013
+ "from": "2025-10-15T05:22:47.435Z",
1014
+ "to": "2025-10-15T06:22:47.435Z"
1015
+ }
994
1016
  }
995
1017
  ```
996
1018
 
997
- **System Events:**
998
- ```json
999
- // System statistics (every 10 seconds)
1000
- {
1001
- "event": "system.stats",
1002
- "data": {
1003
- "pending": 200,
1004
- "processing": 50,
1005
- "recentCreated": 120, // Last minute
1006
- "recentCompleted": 115, // Last minute
1007
- "connections": 5 // WebSocket connections
1008
- },
1009
- "timestamp": "2025-10-08T07:30:00.000Z"
1010
- }
1019
+ **Status Codes:**
1020
+ - `200`: Success
1021
+ - `404`: Queue not found
1022
+ - `500`: Internal server error
1011
1023
 
1012
- // Client connected
1013
- {
1014
- "event": "client.connected",
1015
- "data": {
1016
- "clientId": "uuid"
1017
- },
1018
- "timestamp": "2025-10-08T07:30:00.000Z"
1019
- }
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
1020
1034
 
1021
- // Client disconnected
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
1022
1045
  {
1023
- "event": "client.disconnected",
1024
- "data": {
1025
- "clientId": "uuid"
1046
+ "messages": [],
1047
+ "pagination": {
1048
+ "limit": 2,
1049
+ "offset": null,
1050
+ "total": 0
1026
1051
  },
1027
- "timestamp": "2025-10-08T07:30:00.000Z"
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
+ }
1028
1061
  }
1029
1062
  ```
1030
1063
 
1031
- #### Client → Server Messages
1064
+ **Status Codes:**
1065
+ - `200`: Success
1066
+ - `500`: Internal server error
1067
+
1068
+ ---
1032
1069
 
1033
- **Keep Alive:**
1034
- ```
1035
- ping
1036
- ```
1037
- Server responds with: `pong`
1070
+ ### GET /api/v1/status/analytics
1071
+
1072
+ **Purpose:** Get analytics data including time series metrics.
1073
+
1074
+ **Authentication:** None
1038
1075
 
1039
- **Subscribe to Queues:**
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:**
1040
1085
  ```json
1041
1086
  {
1042
- "type": "subscribe",
1043
- "queues": ["emails", "payments", "notifications"]
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
1044
1094
  }
1045
1095
  ```
1046
1096
 
1047
- **Note:** Subscription is optional and currently for future filtering implementation
1097
+ **Status Codes:**
1098
+ - `200`: Success
1099
+ - `500`: Internal server error
1048
1100
 
1049
1101
  ---
1050
1102
 
1051
1103
  ## Error Responses
1052
1104
 
1053
- All endpoints may return error responses:
1105
+ All endpoints may return error responses in the following format:
1054
1106
 
1055
1107
  ```json
1056
1108
  {
@@ -1058,59 +1110,117 @@ All endpoints may return error responses:
1058
1110
  }
1059
1111
  ```
1060
1112
 
1061
- **Common Status Codes:**
1062
- - `200`: Success
1063
- - `201`: Created
1064
- - `204`: No Content (empty response)
1065
- - `400`: Bad Request (invalid parameters)
1066
- - `404`: Not Found
1067
- - `500`: Internal Server Error
1068
- - `503`: Service Unavailable (database connection issues)
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
1069
1122
 
1070
1123
  ---
1071
1124
 
1072
- ## Performance Considerations
1125
+ ## WebSocket API
1073
1126
 
1074
- 1. **Batch Operations**: Use batch push/pop for better throughput
1075
- 2. **Long Polling**: Use `wait=true` to reduce polling overhead
1076
- 3. **Partition Strategy**: Use multiple partitions for parallel processing
1077
- 4. **Lease Time**: Set appropriate lease times based on processing duration
1078
- 5. **Connection Pooling**: System supports up to 10,000+ messages/second with proper configuration
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
1079
1135
 
1080
1136
  ---
1081
1137
 
1082
- ## Example Usage Flow
1138
+ ## Notes
1083
1139
 
1084
- ```javascript
1085
- // 1. Push a message
1086
- POST /api/v1/push
1087
- {
1088
- "items": [{
1089
- "queue": "orders",
1090
- "partition": "high-priority",
1091
- "payload": { "orderId": "12345", "amount": 99.99 }
1092
- }]
1093
- }
1140
+ 1. **CORS**: All endpoints support CORS with permissive settings. In production, configure appropriate CORS settings.
1094
1141
 
1095
- // 2. Pop the message
1096
- GET /api/v1/pop/queue/orders/partition/high-priority
1142
+ 2. **Pagination**: Most list endpoints support pagination via `limit` and `offset` query parameters.
1097
1143
 
1098
- // 3. Process the message...
1144
+ 3. **Time Ranges**: Status and analytics endpoints default to the last 1 hour if no time range is specified.
1099
1145
 
1100
- // 4. Acknowledge completion
1101
- POST /api/v1/ack
1102
- {
1103
- "transactionId": "returned-transaction-id",
1104
- "status": "completed"
1105
- }
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
+ }'
1106
1219
  ```
1107
1220
 
1108
1221
  ---
1109
1222
 
1110
- ## CORS Support
1223
+ **Last Updated:** October 15, 2025
1224
+ **API Version:** v1
1225
+ **Server Version:** Queen Message Queue
1111
1226
 
1112
- All endpoints include CORS headers:
1113
- - `Access-Control-Allow-Origin: *`
1114
- - `Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS`
1115
- - `Access-Control-Allow-Headers: Content-Type, Authorization`
1116
- - `Access-Control-Max-Age: 86400`