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/DASHBOARD.md DELETED
@@ -1,382 +0,0 @@
1
- # Queen Dashboard - Frontend Development Plan
2
-
3
- ## Overview
4
- A modern, responsive web dashboard for the Queen V2 message queue system, built with Vue 3, PrimeVue, and Vite. The dashboard provides real-time monitoring, resource management, and analytics capabilities.
5
-
6
- ## Technology Stack
7
- - **Framework**: Vue 3 (Composition API)
8
- - **UI Library**: PrimeVue 4.x
9
- - **Build Tool**: Vite
10
- - **Module System**: ESM
11
- - **Styling**: PrimeVue themes + custom CSS
12
- - **Charts**: Chart.js with PrimeVue Chart component
13
- - **HTTP Client**: Native fetch API
14
- - **WebSocket**: Native WebSocket API
15
- - **State Management**: Vue 3 reactive/ref (no Vuex needed for this scale)
16
- - **Routing**: Vue Router 4
17
- - **Icons**: PrimeIcons
18
- - **Date Handling**: Native JavaScript Date + Intl API
19
-
20
- ## Project Structure
21
- ```
22
- dashboard/
23
- ├── index.html
24
- ├── package.json
25
- ├── vite.config.js
26
- ├── public/
27
- │ └── favicon.ico
28
- └── src/
29
- ├── main.js # App entry point
30
- ├── App.vue # Root component
31
- ├── router.js # Route definitions
32
- ├── assets/
33
- │ └── styles/
34
- │ ├── main.css # Global styles
35
- │ └── variables.css # CSS variables
36
- ├── components/
37
- │ ├── layout/
38
- │ │ ├── AppHeader.vue # Top navigation bar
39
- │ │ ├── AppSidebar.vue # Side navigation
40
- │ │ └── AppLayout.vue # Main layout wrapper
41
- │ ├── charts/
42
- │ │ ├── ThroughputChart.vue # Real-time throughput
43
- │ │ ├── QueueDepthChart.vue # Queue depths over time
44
- │ │ ├── MessageStatusChart.vue # Message status distribution
45
- │ │ └── LatencyChart.vue # Processing latency
46
- │ ├── cards/
47
- │ │ ├── MetricCard.vue # Single metric display
48
- │ │ ├── QueueCard.vue # Queue summary card
49
- │ │ └── SystemHealthCard.vue # System health indicator
50
- │ └── common/
51
- │ ├── DataTable.vue # Reusable data table
52
- │ ├── LoadingSpinner.vue # Loading indicator
53
- │ └── ErrorMessage.vue # Error display
54
- ├── views/
55
- │ ├── Dashboard.vue # Main dashboard
56
- │ ├── Queues.vue # Queue management
57
- │ ├── QueueDetail.vue # Single queue details
58
- │ ├── Partitions.vue # Partition management
59
- │ ├── Analytics.vue # Analytics & metrics
60
- │ ├── Messages.vue # Message browser
61
- │ └── System.vue # System overview
62
- ├── services/
63
- │ ├── api.js # API client
64
- │ ├── websocket.js # WebSocket manager
65
- │ └── formatter.js # Data formatters
66
- └── utils/
67
- ├── constants.js # App constants
68
- ├── colors.js # Chart colors
69
- └── helpers.js # Utility functions
70
- ```
71
-
72
- ## Core Features
73
-
74
- ### 1. Dashboard View
75
- **Purpose**: Real-time system overview and key metrics
76
-
77
- **Components**:
78
- - **System Health Card**: Connection status, uptime, active connections
79
- - **Message Metrics Cards**:
80
- - Total messages (with trend)
81
- - Pending messages
82
- - Processing messages
83
- - Completed today
84
- - Failed today
85
- - Messages/second rate
86
- - **Throughput Chart**: Line chart showing incoming/completed/failed rates over last hour
87
- - **Queue Depth Chart**: Stacked bar chart of top 10 queues by depth
88
- - **Recent Activity Feed**: Live feed of recent message events via WebSocket
89
- - **Quick Actions**: Buttons for common tasks
90
-
91
- **Data Sources**:
92
- - `/health` - System health
93
- - `/api/v1/analytics/throughput` - Throughput metrics
94
- - `/api/v1/analytics/queue-depths` - Queue depths
95
- - `/api/v1/resources/overview` - System overview
96
- - WebSocket events for real-time updates
97
-
98
- ### 2. Resource Management
99
-
100
- #### 2.1 Queues View
101
- **Purpose**: Manage and monitor all queues
102
-
103
- **Features**:
104
- - **Queue List Table**:
105
- - Queue name
106
- - Namespace/Task tags
107
- - Partition count
108
- - Total messages
109
- - Pending/Processing counts
110
- - Created date
111
- - Actions (View, Configure, Clear)
112
- - **Filters**: By namespace, task, or search
113
- - **Sorting**: By name, depth, created date
114
- - **Bulk Actions**: Clear multiple queues
115
-
116
- **Data Sources**:
117
- - `/api/v1/resources/queues` - Queue list
118
- - `/api/v1/analytics/queues` - Queue statistics
119
-
120
- #### 2.2 Queue Detail View
121
- **Purpose**: Detailed view of a single queue
122
-
123
- **Features**:
124
- - **Queue Info Card**: Name, namespace, task, created date
125
- - **Partition List**:
126
- - Partition name
127
- - Priority
128
- - Message counts by status
129
- - Configuration (lease time, retry limit)
130
- - Actions (Configure, Clear)
131
- - **Message Status Pie Chart**: Distribution of message states
132
- - **Recent Messages Table**: Last 20 messages with status
133
- - **Configuration Panel**: Edit queue/partition settings
134
-
135
- **Data Sources**:
136
- - `/api/v1/resources/queues/:queue` - Queue details
137
- - `/api/v1/messages?queue=:queue` - Recent messages
138
- - `/api/v1/configure` - Update configuration
139
-
140
- #### 2.3 Partitions View
141
- **Purpose**: Global partition management
142
-
143
- **Features**:
144
- - **Partition Table**:
145
- - Queue/Partition path
146
- - Priority
147
- - Depth
148
- - Processing count
149
- - Configuration summary
150
- - **Filter by Queue**: Dropdown to filter partitions
151
- - **Sort by Priority/Depth**: Quick sorting options
152
-
153
- **Data Sources**:
154
- - `/api/v1/resources/partitions` - All partitions
155
-
156
- ### 3. Analytics View
157
- **Purpose**: Detailed performance metrics and trends
158
-
159
- **Features**:
160
- - **Time Range Selector**: Last hour, 6 hours, 24 hours, 7 days
161
- - **Multi-Metric Chart**:
162
- - Incoming rate
163
- - Completion rate
164
- - Failure rate
165
- - Processing lag
166
- - **Queue Performance Table**:
167
- - Queue name
168
- - Throughput (msg/min)
169
- - Average processing time
170
- - Success rate
171
- - Error rate
172
- - **System Performance Cards**:
173
- - Database pool usage
174
- - Memory usage
175
- - CPU usage
176
- - Request rate
177
- - **Top Queues by Volume**: Bar chart
178
- - **Top Queues by Errors**: Bar chart
179
-
180
- **Data Sources**:
181
- - `/api/v1/analytics/throughput` - Throughput data
182
- - `/api/v1/analytics/queue-stats` - Queue statistics
183
- - `/metrics` - System metrics
184
-
185
- ### 4. Messages View
186
- **Purpose**: Browse and manage individual messages
187
-
188
- **Features**:
189
- - **Message Search**:
190
- - By queue
191
- - By partition
192
- - By status
193
- - By date range
194
- - **Message Table**:
195
- - Transaction ID
196
- - Queue/Partition
197
- - Status with color coding
198
- - Created/Completed times
199
- - Retry count
200
- - Actions (View, Retry, Delete, Move to DLQ)
201
- - **Message Detail Modal**:
202
- - Full payload JSON viewer
203
- - Complete timeline
204
- - Error details if failed
205
- - Related messages
206
-
207
- **Data Sources**:
208
- - `/api/v1/messages` - Message list
209
- - `/api/v1/messages/:id` - Message details
210
- - `/api/v1/messages/:id/related` - Related messages
211
-
212
- ## UI/UX Design Principles
213
-
214
- ### Visual Design
215
- 1. **Color Scheme**:
216
- - Primary: PrimeVue Aura theme (blue/indigo)
217
- - Success: Green (#10b981)
218
- - Warning: Amber (#f59e0b)
219
- - Error: Red (#ef4444)
220
- - Neutral: Gray scale
221
-
222
- 2. **Typography**:
223
- - Headers: Inter or system font
224
- - Body: System font stack
225
- - Monospace: For IDs and code
226
-
227
- 3. **Layout**:
228
- - Fixed header with navigation
229
- - Collapsible sidebar for mobile
230
- - Content area with consistent padding
231
- - Card-based component layout
232
-
233
- 4. **Animations**:
234
- - Smooth transitions for route changes
235
- - Subtle hover effects
236
- - Loading skeletons for data fetching
237
- - Real-time data updates with fade effects
238
-
239
- ### Responsive Design
240
- - **Desktop** (>1024px): Full sidebar, multi-column layouts
241
- - **Tablet** (768-1024px): Collapsible sidebar, adjusted grids
242
- - **Mobile** (<768px): Bottom navigation, single column, simplified charts
243
-
244
- ### Accessibility
245
- - Proper ARIA labels
246
- - Keyboard navigation support
247
- - High contrast mode support
248
- - Screen reader friendly
249
-
250
- ## Real-time Features
251
-
252
- ### WebSocket Integration
253
- ```javascript
254
- // Connection management
255
- - Auto-reconnect on disconnect
256
- - Heartbeat/ping-pong
257
- - Event subscription system
258
-
259
- // Event handling
260
- - Queue depth updates (every 5s)
261
- - Message state changes
262
- - System statistics (every 10s)
263
- - Visual indicators for real-time data
264
- ```
265
-
266
- ### Data Refresh Strategy
267
- - Dashboard: Real-time via WebSocket
268
- - Resource views: Refresh on focus + manual refresh
269
- - Analytics: Auto-refresh every 30s
270
- - Messages: Manual refresh only
271
-
272
- ## Performance Optimizations
273
-
274
- 1. **Code Splitting**:
275
- - Lazy load routes
276
- - Dynamic import for charts
277
-
278
- 2. **Data Management**:
279
- - Pagination for large datasets
280
- - Virtual scrolling for long lists
281
- - Debounced search inputs
282
-
283
- 3. **Caching**:
284
- - Cache static resources
285
- - Short-term cache for analytics data
286
-
287
- 4. **Bundle Size**:
288
- - Tree-shake PrimeVue components
289
- - Minimize external dependencies
290
-
291
- ## Implementation Phases
292
-
293
- ### Phase 1: Foundation (Current Focus)
294
- 1. ✅ Project setup with Vite
295
- 2. ✅ PrimeVue integration
296
- 3. ✅ Basic routing structure
297
- 4. ✅ Layout components
298
- 5. ✅ API service layer
299
-
300
- ### Phase 2: Core Views
301
- 1. ✅ Dashboard with basic metrics
302
- 2. ✅ Queue list and management
303
- 3. ✅ Basic analytics view
304
- 4. ✅ WebSocket connection
305
-
306
- ### Phase 3: Enhanced Features
307
- 1. ⏳ Advanced charts and visualizations
308
- 2. ⏳ Message browser and management
309
- 3. ⏳ Partition configuration UI
310
- 4. ⏳ System health monitoring
311
-
312
- ### Phase 4: Polish
313
- 1. ⏳ Responsive design refinements
314
- 2. ⏳ Dark mode support
315
- 3. ⏳ Export functionality
316
- 4. ⏳ User preferences
317
-
318
- ## API Integration Patterns
319
-
320
- ### Error Handling
321
- ```javascript
322
- // Consistent error handling
323
- try {
324
- const data = await api.get('/endpoint')
325
- } catch (error) {
326
- toast.add({
327
- severity: 'error',
328
- summary: 'Error',
329
- detail: error.message
330
- })
331
- }
332
- ```
333
-
334
- ### Loading States
335
- - Show skeleton loaders during fetch
336
- - Disable buttons during operations
337
- - Progress bars for long operations
338
-
339
- ### Data Formatting
340
- - Human-readable timestamps
341
- - Number formatting (1.2K, 3.4M)
342
- - Status badges with colors
343
- - Percentage calculations
344
-
345
- ## Development Guidelines
346
-
347
- ### Component Structure
348
- - Use Composition API with `<script setup>`
349
- - Props validation with type definitions
350
- - Emit events for parent communication
351
- - Scoped styles with CSS modules where needed
352
-
353
- ### State Management
354
- - Local state with ref/reactive
355
- - Provide/inject for cross-component state
356
- - No global store needed initially
357
-
358
- ### Code Style
359
- - ESLint for code quality
360
- - Prettier for formatting
361
- - Meaningful variable names
362
- - Comments for complex logic
363
-
364
- ## Testing Approach
365
- - Manual testing for UI/UX
366
- - API mocking for development
367
- - Browser compatibility testing
368
- - Performance profiling with Lighthouse
369
-
370
- ## Deployment
371
- - Build with Vite: `npm run build`
372
- - Serve static files from `/dashboard` path
373
- - Configure server to proxy API calls
374
- - Enable gzip compression
375
-
376
- ## Future Enhancements
377
- - User authentication and authorization
378
- - Custom alerting and notifications
379
- - Data export (CSV, JSON)
380
- - Saved filters and views
381
- - Dashboard customization
382
- - Mobile app consideration