queen-mq 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/API.md +1226 -0
  2. package/AUTH.md +2044 -0
  3. package/LICENSE.md +202 -0
  4. package/PROGRAMMATIC_SERVER.md +190 -0
  5. package/README.md +303 -53
  6. package/WEBAPP.md +1889 -0
  7. package/assets/dashboard-01.png +0 -0
  8. package/assets/queen-logo-blue.svg +210 -0
  9. package/assets/queen-logo-cyan.svg +210 -0
  10. package/assets/queen-logo-indigo.svg +210 -0
  11. package/assets/queen-logo-orange.svg +210 -0
  12. package/assets/queen-logo-pink.svg +210 -0
  13. package/assets/queen-logo-purple.svg +210 -0
  14. package/assets/queen-logo-rose.svg +239 -0
  15. package/assets/queen-logo.svg +263 -0
  16. package/examples/batch-processing.js +58 -0
  17. package/examples/programmatic-server.js +58 -0
  18. package/examples/test-cache-multi-server.js +2 -2
  19. package/examples/test-connection-recovery.js +66 -0
  20. package/examples/test-dashboard-api.js +200 -0
  21. package/package.json +4 -2
  22. package/server.log +1 -0
  23. package/src/benchmark/consumer.js +207 -0
  24. package/src/benchmark/consumer_multi.js +216 -0
  25. package/src/benchmark/producer.js +75 -0
  26. package/src/benchmark/producer_multi.js +115 -0
  27. package/src/client/client.js +219 -17
  28. package/src/client/index.js +4 -3
  29. package/src/cluster-server.js +242 -0
  30. package/src/config.js +19 -5
  31. package/src/database/connection.js +42 -16
  32. package/src/database/poolManager.js +7 -0
  33. package/src/database/schema-v2.sql +194 -130
  34. package/src/managers/queueManagerOptimized.js +852 -933
  35. package/src/managers/systemEventManager.js +8 -3
  36. package/src/routes/messages.js +127 -57
  37. package/src/routes/pop.js +27 -43
  38. package/src/routes/resources.js +61 -27
  39. package/src/routes/status.js +1037 -0
  40. package/src/server.js +704 -642
  41. package/src/services/evictionService.js +57 -28
  42. package/src/services/retentionService.js +44 -11
  43. package/src/services/startupSync.js +1 -1
  44. package/src/test/advanced-pattern-tests.js +6 -6
  45. package/src/test/bus-mode-tests.js +24 -11
  46. package/src/test/core-tests.js +110 -0
  47. package/src/test/edge-case-tests.js +12 -5
  48. package/src/test/enterprise-tests.js +48 -15
  49. package/src/test/test-new.js +3 -1
  50. package/src/test/test.js +1 -1
  51. package/src/test/utils.js +1 -1
  52. package/src/test/window-buffer-test.js +114 -0
  53. package/src/utils/streaming.js +231 -0
  54. package/src/utils/uuid.js +2 -2
  55. package/src/websocket/wsServer.js +10 -3
  56. package/test-keepalive-v2.sh +22 -0
  57. package/webapp/COLOR_GUIDE.md +118 -0
  58. package/webapp/README.md +143 -0
  59. package/webapp/index.html +14 -0
  60. package/webapp/package-lock.json +3184 -0
  61. package/webapp/package.json +25 -0
  62. package/webapp/postcss.config.js +7 -0
  63. package/webapp/public/assets/queen-logo-blue.svg +210 -0
  64. package/webapp/public/assets/queen-logo-cyan.svg +210 -0
  65. package/webapp/public/assets/queen-logo-indigo.svg +210 -0
  66. package/webapp/public/assets/queen-logo-orange.svg +210 -0
  67. package/webapp/public/assets/queen-logo-pink.svg +210 -0
  68. package/webapp/public/assets/queen-logo-purple.svg +210 -0
  69. package/webapp/public/assets/queen-logo-rose.svg +239 -0
  70. package/webapp/public/assets/queen-logo.svg +263 -0
  71. package/webapp/src/App.vue +19 -0
  72. package/webapp/src/api/analytics.js +10 -0
  73. package/webapp/src/api/client.js +29 -0
  74. package/webapp/src/api/consumers.js +52 -0
  75. package/webapp/src/api/health.js +7 -0
  76. package/webapp/src/api/messages.js +26 -0
  77. package/webapp/src/api/queues.js +14 -0
  78. package/webapp/src/api/resources.js +8 -0
  79. package/webapp/src/assets/styles/main.css +357 -0
  80. package/webapp/src/components/analytics/AnalyticsFilters.vue +87 -0
  81. package/webapp/src/components/analytics/AnalyticsMetrics.vue +57 -0
  82. package/webapp/src/components/analytics/MessageDistributionChart.vue +111 -0
  83. package/webapp/src/components/analytics/MessageFlowChart.vue +173 -0
  84. package/webapp/src/components/analytics/TimeRangeSelector.vue +27 -0
  85. package/webapp/src/components/analytics/TopQueuesChart.vue +132 -0
  86. package/webapp/src/components/common/ConfirmDialog.vue +56 -0
  87. package/webapp/src/components/common/LoadingSpinner.vue +6 -0
  88. package/webapp/src/components/common/MetricCard.vue +43 -0
  89. package/webapp/src/components/common/StatusBadge.vue +45 -0
  90. package/webapp/src/components/dashboard/MessageStatusCard.vue +50 -0
  91. package/webapp/src/components/dashboard/PerformanceCard.vue +38 -0
  92. package/webapp/src/components/dashboard/ThroughputChart.vue +182 -0
  93. package/webapp/src/components/dashboard/TopQueuesTable.vue +53 -0
  94. package/webapp/src/components/layout/AppLayout.vue +110 -0
  95. package/webapp/src/components/layout/AppSidebar.vue +304 -0
  96. package/webapp/src/components/messages/MessageDetailPanel.vue +242 -0
  97. package/webapp/src/components/messages/MessageFilters.vue +101 -0
  98. package/webapp/src/components/queue-detail/PartitionList.vue +79 -0
  99. package/webapp/src/components/queue-detail/PushMessageModal.vue +175 -0
  100. package/webapp/src/components/queue-detail/QueueConfig.vue +63 -0
  101. package/webapp/src/components/queue-detail/QueueDetailHeader.vue +53 -0
  102. package/webapp/src/components/queue-detail/RecentMessages.vue +76 -0
  103. package/webapp/src/components/queues/CreateQueueModal.vue +193 -0
  104. package/webapp/src/components/queues/QueueFilters.vue +90 -0
  105. package/webapp/src/composables/useApi.js +34 -0
  106. package/webapp/src/composables/useTheme.js +36 -0
  107. package/webapp/src/main.js +11 -0
  108. package/webapp/src/router/index.js +42 -0
  109. package/webapp/src/utils/colors.js +96 -0
  110. package/webapp/src/utils/formatters.js +49 -0
  111. package/webapp/src/views/Analytics.vue +377 -0
  112. package/webapp/src/views/ConsumerGroups.vue +433 -0
  113. package/webapp/src/views/Dashboard.vue +418 -0
  114. package/webapp/src/views/Messages.vue +363 -0
  115. package/webapp/src/views/QueueDetail.vue +582 -0
  116. package/webapp/src/views/Queues.vue +496 -0
  117. package/webapp/tailwind.config.js +25 -0
  118. package/webapp/vite.config.js +10 -0
  119. package/dashboard/.vscode/extensions.json +0 -3
  120. package/dashboard/README.md +0 -5
  121. package/dashboard/index.html +0 -14
  122. package/dashboard/package-lock.json +0 -1458
  123. package/dashboard/package.json +0 -25
  124. package/dashboard/public/vite.svg +0 -1
  125. package/dashboard/src/App.vue +0 -29
  126. package/dashboard/src/assets/styles/main.css +0 -908
  127. package/dashboard/src/assets/vue.svg +0 -1
  128. package/dashboard/src/components/cards/MetricCard.vue +0 -298
  129. package/dashboard/src/components/charts/QueueDepthChart.vue +0 -276
  130. package/dashboard/src/components/charts/QueueLagChart.vue +0 -436
  131. package/dashboard/src/components/charts/ThroughputChart.vue +0 -302
  132. package/dashboard/src/components/common/ActivityFeed.vue +0 -251
  133. package/dashboard/src/components/layout/AppHeader.vue +0 -208
  134. package/dashboard/src/components/layout/AppLayout.vue +0 -88
  135. package/dashboard/src/components/layout/AppSidebar.vue +0 -261
  136. package/dashboard/src/main.js +0 -44
  137. package/dashboard/src/router.js +0 -54
  138. package/dashboard/src/services/api.js +0 -187
  139. package/dashboard/src/services/websocket.js +0 -167
  140. package/dashboard/src/utils/constants.js +0 -56
  141. package/dashboard/src/utils/helpers.js +0 -118
  142. package/dashboard/src/views/Analytics.vue +0 -912
  143. package/dashboard/src/views/Dashboard.vue +0 -906
  144. package/dashboard/src/views/Messages.vue +0 -437
  145. package/dashboard/src/views/QueueDetail.vue +0 -501
  146. package/dashboard/src/views/Queues.vue +0 -333
  147. package/dashboard/vite.config.js +0 -30
  148. package/src/client/queenClient.js +0 -513
  149. package/src/routes/analytics.js +0 -812
@@ -0,0 +1,363 @@
1
+ <template>
2
+ <div class="page-flat">
3
+ <div class="py-4 px-3">
4
+ <div class="space-y-2.5">
5
+ <!-- Info Banner (shown when API needs restart) -->
6
+ <div v-if="apiNeedsRestart" class="warning-banner">
7
+ <div class="flex gap-3">
8
+ <svg class="w-5 h-5 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
9
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z" />
10
+ </svg>
11
+ <div class="text-sm">
12
+ <p class="font-semibold mb-1">API Update Required</p>
13
+ <p class="text-yellow-800 dark:text-yellow-200">
14
+ The messages API has been fixed. Please restart the Queen server for changes to take effect.
15
+ </p>
16
+ </div>
17
+ </div>
18
+ </div>
19
+
20
+ <!-- Filters -->
21
+ <div class="filter-flat">
22
+ <MessageFilters
23
+ v-model:search="searchQuery"
24
+ v-model:queue="queueFilter"
25
+ v-model:status="statusFilter"
26
+ :queues="queues"
27
+ />
28
+ </div>
29
+
30
+ <LoadingSpinner v-if="loading && !messages.length" />
31
+
32
+ <div v-else-if="error" class="error-flat">
33
+ <p><strong>Error loading messages:</strong> {{ error }}</p>
34
+ </div>
35
+
36
+ <!-- Messages Table -->
37
+ <div v-else class="table-flat">
38
+ <div class="table-container scrollbar-thin">
39
+ <table class="table">
40
+ <thead>
41
+ <tr>
42
+ <th>Transaction ID</th>
43
+ <th class="hidden md:table-cell">Queue</th>
44
+ <th class="hidden lg:table-cell">Partition</th>
45
+ <th class="text-right">Created</th>
46
+ <th class="text-right">Status</th>
47
+ </tr>
48
+ </thead>
49
+ <tbody>
50
+ <tr
51
+ v-for="message in messages"
52
+ :key="message.id"
53
+ class="cursor-pointer"
54
+ @click="selectMessage(message)"
55
+ >
56
+ <td>
57
+ <div class="font-mono text-xs">{{ message.transactionId.substring(0, 20) }}...</div>
58
+ <div class="text-xs text-gray-500 dark:text-gray-400 md:hidden">
59
+ {{ message.queue }}
60
+ </div>
61
+ </td>
62
+ <td class="hidden md:table-cell">
63
+ <div class="text-sm">{{ message.queue }}</div>
64
+ </td>
65
+ <td class="hidden lg:table-cell">
66
+ <span class="text-xs text-gray-600 dark:text-gray-400">{{ message.partition }}</span>
67
+ </td>
68
+ <td class="text-right text-xs">{{ formatTime(message.createdAt) }}</td>
69
+ <td class="text-right">
70
+ <StatusBadge :status="message.status" :show-dot="false" />
71
+ </td>
72
+ </tr>
73
+ </tbody>
74
+ </table>
75
+
76
+ <div v-if="!messages.length && !loading" class="text-center py-12 text-gray-500 text-sm">
77
+ <svg class="w-12 h-12 mx-auto mb-3 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
78
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" />
79
+ </svg>
80
+ <p>No messages found</p>
81
+ </div>
82
+ </div>
83
+
84
+ <!-- Pagination -->
85
+ <div v-if="totalPages > 1" class="flex items-center justify-between mt-4 pt-4 border-t border-gray-200/30 dark:border-gray-700/30">
86
+ <div class="text-sm text-gray-600 dark:text-gray-400">
87
+ Page {{ currentPage }} of {{ totalPages }}
88
+ </div>
89
+ <div class="flex gap-2">
90
+ <button
91
+ @click="currentPage--"
92
+ :disabled="currentPage === 1"
93
+ class="btn btn-secondary px-3 py-1.5"
94
+ >
95
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
96
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
97
+ </svg>
98
+ </button>
99
+ <button
100
+ @click="currentPage++"
101
+ :disabled="currentPage === totalPages"
102
+ class="btn btn-secondary px-3 py-1.5"
103
+ >
104
+ <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
105
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
106
+ </svg>
107
+ </button>
108
+ </div>
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </div>
113
+
114
+ <!-- Message Detail Panel -->
115
+ <MessageDetailPanel
116
+ :is-open="!!selectedMessage"
117
+ :message="selectedMessage"
118
+ @close="selectedMessage = null"
119
+ @action-complete="onActionComplete"
120
+ />
121
+ </div>
122
+ </template>
123
+
124
+ <script setup>
125
+ import { ref, watch, onMounted, onUnmounted } from 'vue';
126
+ import { useRoute } from 'vue-router';
127
+ import { messagesApi } from '../api/messages';
128
+ import { queuesApi } from '../api/queues';
129
+ import { formatTime } from '../utils/formatters';
130
+
131
+ import MessageFilters from '../components/messages/MessageFilters.vue';
132
+ import MessageDetailPanel from '../components/messages/MessageDetailPanel.vue';
133
+ import StatusBadge from '../components/common/StatusBadge.vue';
134
+ import LoadingSpinner from '../components/common/LoadingSpinner.vue';
135
+
136
+ const route = useRoute();
137
+
138
+ const loading = ref(false);
139
+ const error = ref(null);
140
+ const messages = ref([]);
141
+ const queues = ref([]);
142
+ const searchQuery = ref('');
143
+ const queueFilter = ref('');
144
+ const statusFilter = ref('');
145
+ const currentPage = ref(1);
146
+ const itemsPerPage = 50;
147
+ const totalPages = ref(1);
148
+ const selectedMessage = ref(null);
149
+ const apiNeedsRestart = ref(false);
150
+
151
+ watch(() => route.query.transactionId, (transactionId) => {
152
+ if (transactionId && messages.value.length) {
153
+ const message = messages.value.find(m => m.transactionId === transactionId);
154
+ if (message) {
155
+ selectedMessage.value = message;
156
+ }
157
+ }
158
+ }, { immediate: true });
159
+
160
+ async function loadData() {
161
+ loading.value = true;
162
+ error.value = null;
163
+ apiNeedsRestart.value = false;
164
+
165
+ try {
166
+ const queuesRes = await queuesApi.getQueues();
167
+ queues.value = queuesRes.data.queues;
168
+
169
+ const params = {
170
+ limit: itemsPerPage,
171
+ offset: (currentPage.value - 1) * itemsPerPage,
172
+ };
173
+
174
+ if (searchQuery.value) {
175
+ try {
176
+ const msgRes = await messagesApi.getMessage(searchQuery.value);
177
+ messages.value = [msgRes.data];
178
+ totalPages.value = 1;
179
+ return;
180
+ } catch {
181
+ // Fall through to regular list
182
+ }
183
+ }
184
+
185
+ if (queueFilter.value) params.queue = queueFilter.value;
186
+ if (statusFilter.value) params.status = statusFilter.value;
187
+
188
+ const messagesRes = await messagesApi.getMessages(params);
189
+ messages.value = messagesRes.data.messages || [];
190
+
191
+ totalPages.value = messages.value.length === itemsPerPage ? currentPage.value + 1 : currentPage.value;
192
+ } catch (err) {
193
+ error.value = err.response?.data?.error || err.message;
194
+
195
+ if (error.value.includes('column m.status does not exist')) {
196
+ apiNeedsRestart.value = true;
197
+ }
198
+ } finally {
199
+ loading.value = false;
200
+ }
201
+ }
202
+
203
+ function selectMessage(message) {
204
+ selectedMessage.value = message;
205
+ }
206
+
207
+ async function onActionComplete() {
208
+ selectedMessage.value = null;
209
+ await loadData();
210
+ }
211
+
212
+ watch([searchQuery, queueFilter, statusFilter], () => {
213
+ currentPage.value = 1;
214
+ loadData();
215
+ });
216
+
217
+ watch(currentPage, () => {
218
+ loadData();
219
+ });
220
+
221
+ onMounted(() => {
222
+ loadData();
223
+
224
+ if (window.registerRefreshCallback) {
225
+ window.registerRefreshCallback('/messages', loadData);
226
+ }
227
+ });
228
+
229
+ onUnmounted(() => {
230
+ if (window.registerRefreshCallback) {
231
+ window.registerRefreshCallback('/messages', null);
232
+ }
233
+ });
234
+ </script>
235
+
236
+ <style scoped>
237
+ .page-flat {
238
+ min-height: 100%;
239
+ }
240
+
241
+ .warning-banner {
242
+ background: #ffffff;
243
+ border: none;
244
+ box-shadow: none;
245
+ border-radius: 0.75rem;
246
+ padding: 1rem;
247
+ border-left: 3px solid rgba(245, 158, 11, 0.5);
248
+ }
249
+
250
+ .dark .warning-banner {
251
+ background: #0a0d14;
252
+ border-left-color: rgba(245, 158, 11, 0.7);
253
+ }
254
+
255
+ .filter-flat {
256
+ background: #ffffff;
257
+ border: none;
258
+ box-shadow: none;
259
+ border-radius: 0.75rem;
260
+ padding: 1rem;
261
+ }
262
+
263
+ .dark .filter-flat {
264
+ background: #0a0d14;
265
+ }
266
+
267
+ .filter-flat :deep(.input) {
268
+ background: transparent;
269
+ border: 1px solid rgba(156, 163, 175, 0.15);
270
+ transition: all 0.2s ease;
271
+ }
272
+
273
+ .filter-flat :deep(.input:hover) {
274
+ border-color: rgba(156, 163, 175, 0.25);
275
+ }
276
+
277
+ .filter-flat :deep(.input:focus) {
278
+ background: rgba(244, 63, 94, 0.02);
279
+ border-color: rgba(244, 63, 94, 0.4);
280
+ box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.05);
281
+ }
282
+
283
+ .dark .filter-flat :deep(.input) {
284
+ border-color: rgba(156, 163, 175, 0.1);
285
+ }
286
+
287
+ .dark .filter-flat :deep(.input:focus) {
288
+ background: rgba(244, 63, 94, 0.03);
289
+ border-color: rgba(244, 63, 94, 0.5);
290
+ box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.08);
291
+ }
292
+
293
+ .table-flat {
294
+ background: #ffffff;
295
+ border: none;
296
+ box-shadow: none;
297
+ border-radius: 0.75rem;
298
+ padding: 1rem 0;
299
+ }
300
+
301
+ .dark .table-flat {
302
+ background: #0a0d14;
303
+ }
304
+
305
+ .table-flat :deep(.table) {
306
+ border-collapse: separate;
307
+ border-spacing: 0;
308
+ }
309
+
310
+ .table-flat :deep(.table thead) {
311
+ background: transparent;
312
+ border-bottom: 1px solid rgba(156, 163, 175, 0.08);
313
+ }
314
+
315
+ .dark .table-flat :deep(.table thead) {
316
+ border-bottom-color: rgba(156, 163, 175, 0.1);
317
+ }
318
+
319
+ .table-flat :deep(.table th) {
320
+ padding: 1rem 1rem;
321
+ font-weight: 600;
322
+ letter-spacing: 0.05em;
323
+ }
324
+
325
+ .table-flat :deep(.table tbody tr) {
326
+ border: none;
327
+ transition: all 0.15s ease;
328
+ }
329
+
330
+ .table-flat :deep(.table tbody tr:nth-child(even)) {
331
+ background: rgba(0, 0, 0, 0.015);
332
+ }
333
+
334
+ .dark .table-flat :deep(.table tbody tr:nth-child(even)) {
335
+ background: rgba(255, 255, 255, 0.02);
336
+ }
337
+
338
+ .table-flat :deep(.table tbody tr:hover) {
339
+ background: rgba(244, 63, 94, 0.03);
340
+ box-shadow: inset 3px 0 0 0 rgba(244, 63, 94, 0.6);
341
+ }
342
+
343
+ .dark .table-flat :deep(.table tbody tr:hover) {
344
+ background: rgba(244, 63, 94, 0.05);
345
+ box-shadow: inset 3px 0 0 0 rgba(244, 63, 94, 0.8);
346
+ }
347
+
348
+ .table-flat :deep(.table td) {
349
+ padding: 0.875rem 1rem;
350
+ border: none;
351
+ }
352
+
353
+ .error-flat {
354
+ background: transparent;
355
+ color: #dc2626;
356
+ font-size: 0.875rem;
357
+ padding: 1rem;
358
+ }
359
+
360
+ .dark .error-flat {
361
+ color: #fca5a5;
362
+ }
363
+ </style>