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/src/utils/uuid.js CHANGED
@@ -1,5 +1,5 @@
1
- import { v4 as uuidv4 } from 'uuid';
1
+ import { v7 as uuidv7 } from 'uuid';
2
2
 
3
3
  export const generateUUID = () => {
4
- return uuidv4();
4
+ return uuidv7();
5
5
  };
@@ -191,10 +191,17 @@ export const createWebSocketServer = (app, eventManager) => {
191
191
  try {
192
192
  const result = await pool.query(`
193
193
  SELECT
194
- (SELECT COUNT(*) FROM queen.messages_status WHERE status = 'pending' AND consumer_group IS NULL) as pending,
195
- (SELECT COUNT(*) FROM queen.messages_status WHERE status = 'processing' AND consumer_group IS NULL) as processing,
194
+ (SELECT COALESCE(SUM(pending_estimate), 0)::integer FROM queen.partition_consumers
195
+ WHERE consumer_group = '__QUEUE_MODE__') as pending,
196
+ (SELECT COUNT(*) FROM queen.partition_consumers
197
+ WHERE consumer_group = '__QUEUE_MODE__'
198
+ AND lease_expires_at IS NOT NULL
199
+ AND lease_expires_at > NOW()) as processing,
196
200
  (SELECT COUNT(*) FROM queen.messages WHERE created_at > NOW() - INTERVAL '1 minute') as recent_created,
197
- (SELECT COUNT(*) FROM queen.messages_status WHERE completed_at > NOW() - INTERVAL '1 minute' AND consumer_group IS NULL) as recent_completed
201
+ (SELECT COALESCE(SUM(CASE WHEN last_consumed_at > NOW() - INTERVAL '1 minute'
202
+ THEN total_batches_consumed ELSE 0 END), 0)::integer
203
+ FROM queen.partition_consumers
204
+ WHERE consumer_group = '__QUEUE_MODE__') as recent_completed
198
205
  `);
199
206
 
200
207
  const stats = result.rows[0];
@@ -0,0 +1,22 @@
1
+ #!/bin/bash
2
+
3
+ # Better connection monitoring for macOS
4
+ echo "Monitoring HTTP connections to Queen servers..."
5
+ echo "Press Ctrl+C to stop"
6
+ echo ""
7
+
8
+ while true; do
9
+ # Use lsof instead of netstat for more reliable results on macOS
10
+ CONN_6632=$(lsof -nP -iTCP:6632 -sTCP:ESTABLISHED 2>/dev/null | grep -v COMMAND | wc -l | tr -d ' ')
11
+ CONN_6633=$(lsof -nP -iTCP:6633 -sTCP:ESTABLISHED 2>/dev/null | grep -v COMMAND | wc -l | tr -d ' ')
12
+
13
+ # Also check all states to see if connections exist at all
14
+ ALL_6632=$(lsof -nP -iTCP:6632 2>/dev/null | grep -v COMMAND | wc -l | tr -d ' ')
15
+ ALL_6633=$(lsof -nP -iTCP:6633 2>/dev/null | grep -v COMMAND | wc -l | tr -d ' ')
16
+
17
+ # Clear line and print
18
+ echo -ne "\r[6632] EST: $CONN_6632 (Total: $ALL_6632) | [6633] EST: $CONN_6633 (Total: $ALL_6633) "
19
+
20
+ sleep 0.5 # Check twice per second
21
+ done
22
+
@@ -0,0 +1,118 @@
1
+ # Color Customization Guide
2
+
3
+ ## Quick Color Change
4
+
5
+ To change the entire app's color scheme, edit **ONE FILE**:
6
+
7
+ ### **File:** `src/utils/colors.js`
8
+
9
+ ```javascript
10
+ export const colors = {
11
+ // PRIMARY COLORS - Change these!
12
+ primary: {
13
+ name: 'Rose',
14
+ hex: '#f43f5e', // Change to your color
15
+ rgb: 'rgb(244, 63, 94)',
16
+ rgba: (opacity) => `rgba(244, 63, 94, ${opacity})`,
17
+ },
18
+ secondary: {
19
+ name: 'Purple',
20
+ hex: '#a855f7', // Change to your color
21
+ rgb: 'rgb(168, 85, 247)',
22
+ rgba: (opacity) => `rgba(168, 85, 247, ${opacity})`,
23
+ },
24
+ // ... rest of config
25
+ };
26
+ ```
27
+
28
+ ## Current Color Scheme
29
+
30
+ **Primary (Charts - Ingested):** Rose (#f43f5e)
31
+ **Secondary (Charts - Processed):** Purple (#a855f7)
32
+
33
+ ## Where Colors Are Used
34
+
35
+ ### **Primary (Rose)**
36
+ - Dashboard throughput chart - "Ingested" line
37
+ - Analytics message flow - "Ingested" line
38
+ - Accent colors
39
+
40
+ ### **Secondary (Purple)**
41
+ - Dashboard throughput chart - "Processed" line
42
+ - Analytics message flow - "Processed" line
43
+ - Top queues bar chart
44
+ - Accent elements
45
+
46
+ ### **Status Colors** (Fixed)
47
+ - Success/Completed: Green
48
+ - Warning/Pending: Yellow
49
+ - Danger/Failed: Red
50
+ - Info: Blue
51
+ - Dead Letter: Gray
52
+
53
+ ## How to Change
54
+
55
+ ### Example: Switch to Blue & Cyan
56
+
57
+ ```javascript
58
+ // In src/utils/colors.js
59
+ primary: {
60
+ name: 'Blue',
61
+ hex: '#3b82f6',
62
+ rgb: 'rgb(59, 130, 246)',
63
+ rgba: (opacity) => `rgba(59, 130, 246, ${opacity})`,
64
+ },
65
+ secondary: {
66
+ name: 'Cyan',
67
+ hex: '#06b6d4',
68
+ rgb: 'rgb(6, 182, 212)',
69
+ rgba: (opacity) => `rgba(6, 182, 212, ${opacity})`,
70
+ },
71
+ ```
72
+
73
+ ### Example: Switch to Orange & Pink
74
+
75
+ ```javascript
76
+ primary: {
77
+ name: 'Orange',
78
+ hex: '#f97316',
79
+ rgb: 'rgb(249, 115, 22)',
80
+ rgba: (opacity) => `rgba(249, 115, 22, ${opacity})`,
81
+ },
82
+ secondary: {
83
+ name: 'Pink',
84
+ hex: '#ec4899',
85
+ rgb: 'rgb(236, 72, 153)',
86
+ rgba: (opacity) => `rgba(236, 72, 153, ${opacity})`,
87
+ },
88
+ ```
89
+
90
+ ## Tailwind Config
91
+
92
+ Also update `tailwind.config.js` for consistency:
93
+
94
+ ```javascript
95
+ colors: {
96
+ 'queen-primary': '#f43f5e', // Match primary
97
+ 'queen-secondary': '#a855f7', // Match secondary
98
+ 'queen-accent': '#ec4899', // Optional third color
99
+ },
100
+ ```
101
+
102
+ ## Current Implementation
103
+
104
+ ✅ **Centralized**: All chart colors in one place
105
+ ✅ **Easy to change**: Edit one file
106
+ ✅ **Consistent**: Used across all charts
107
+ ✅ **Type-safe**: Helper functions for opacity
108
+
109
+ ## Files Using Color System
110
+
111
+ 1. `src/components/dashboard/ThroughputChart.vue`
112
+ 2. `src/components/analytics/MessageFlowChart.vue`
113
+ 3. `src/components/analytics/TopQueuesChart.vue`
114
+ 4. `src/components/analytics/MessageDistributionChart.vue`
115
+ 5. `tailwind.config.js` (for CSS utilities)
116
+
117
+ Change `src/utils/colors.js` and all charts update automatically! 🎨
118
+
@@ -0,0 +1,143 @@
1
+ # Queen Message Queue - Web Application
2
+
3
+ Modern web interface for managing and monitoring the Queen Message Queue system.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 18+
8
+ - npm or yarn
9
+ - Queen Message Queue server running on `http://localhost:6632`
10
+
11
+ ## Installation
12
+
13
+ Install dependencies:
14
+
15
+ ```bash
16
+ npm install vue@latest vue-router@latest axios@latest
17
+ npm install chart.js@latest vue-chartjs@latest
18
+ npm install -D vite@latest @vitejs/plugin-vue@latest
19
+ npm install -D tailwindcss@latest postcss@latest autoprefixer@latest
20
+ ```
21
+
22
+ Or all at once:
23
+
24
+ ```bash
25
+ npm install vue vue-router axios chart.js vue-chartjs && npm install -D vite @vitejs/plugin-vue tailwindcss postcss autoprefixer
26
+ ```
27
+
28
+ ## Configuration
29
+
30
+ The application connects to the Queen API at `http://localhost:6632` by default.
31
+
32
+ To change this, create a `.env` file:
33
+
34
+ ```
35
+ VITE_API_BASE_URL=http://your-api-url:port
36
+ ```
37
+
38
+ ## Development
39
+
40
+ Start the development server on port 4000:
41
+
42
+ ```bash
43
+ npm run dev
44
+ ```
45
+
46
+ The application will be available at `http://localhost:4000`
47
+
48
+ ## Build for Production
49
+
50
+ ```bash
51
+ npm run build
52
+ ```
53
+
54
+ Output will be in the `dist/` directory.
55
+
56
+ ## Features
57
+
58
+ ### ✅ Implemented (Dashboard)
59
+ - Real-time health monitoring
60
+ - System metrics and statistics
61
+ - Message throughput visualization
62
+ - Performance monitoring
63
+ - Top queues overview
64
+ - Dark/light theme support
65
+
66
+ ### 🚧 Coming Soon
67
+ - Queues management
68
+ - Queue detail views
69
+ - Consumer groups monitoring
70
+ - Message browser
71
+ - Analytics and insights
72
+
73
+ ## Architecture
74
+
75
+ ### Technology Stack
76
+ - **Vue 3** - Composition API
77
+ - **Vue Router** - Client-side routing
78
+ - **Axios** - HTTP client
79
+ - **Chart.js** - Data visualization
80
+ - **Tailwind CSS** - Styling
81
+ - **Vite** - Build tool
82
+
83
+ ### Project Structure
84
+
85
+ ```
86
+ webapp/
87
+ ├── public/ # Static assets
88
+ ├── src/
89
+ │ ├── api/ # API client modules
90
+ │ ├── assets/ # Styles and fonts
91
+ │ ├── components/ # Vue components
92
+ │ │ ├── common/ # Reusable components
93
+ │ │ ├── dashboard/ # Dashboard-specific
94
+ │ │ └── layout/ # Layout components
95
+ │ ├── composables/ # Vue composables
96
+ │ ├── router/ # Router configuration
97
+ │ ├── utils/ # Utility functions
98
+ │ └── views/ # Page components
99
+ ```
100
+
101
+ ## API Integration
102
+
103
+ The application integrates with the following Queen API endpoints:
104
+
105
+ **Dashboard:**
106
+ - `GET /health` - Server health
107
+ - `GET /metrics` - System metrics
108
+ - `GET /api/v1/resources/overview` - System overview
109
+ - `GET /api/v1/status` - Status with throughput
110
+ - `GET /api/v1/resources/queues` - Queue list
111
+
112
+ All API calls use real data - no mocking!
113
+
114
+ ## Development Notes
115
+
116
+ - **No WebSocket** - Currently using manual refresh only
117
+ - **No Auto-refresh** - User-controlled data updates
118
+ - **Clean Design** - Minimal animations, focus on clarity
119
+ - **Responsive** - Works on desktop and tablet
120
+ - **Theme Support** - Full light/dark mode
121
+
122
+ ## Troubleshooting
123
+
124
+ **CORS Errors:**
125
+ Ensure the Queen server has CORS enabled. The server should include:
126
+ ```
127
+ Access-Control-Allow-Origin: *
128
+ ```
129
+
130
+ **API Connection:**
131
+ Check that the Queen server is running on port 6632:
132
+ ```bash
133
+ curl http://localhost:6632/health
134
+ ```
135
+
136
+ **Port 4000 in use:**
137
+ Change the port in `vite.config.js`:
138
+ ```javascript
139
+ server: {
140
+ port: 4001, // or another port
141
+ }
142
+ ```
143
+
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/assets/queen-logo.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Queen Message Queue</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.js"></script>
12
+ </body>
13
+ </html>
14
+