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.
- package/API.md +1226 -0
- package/AUTH.md +2044 -0
- package/LICENSE.md +202 -0
- package/PROGRAMMATIC_SERVER.md +190 -0
- package/README.md +303 -53
- package/WEBAPP.md +1889 -0
- package/assets/dashboard-01.png +0 -0
- package/assets/queen-logo-blue.svg +210 -0
- package/assets/queen-logo-cyan.svg +210 -0
- package/assets/queen-logo-indigo.svg +210 -0
- package/assets/queen-logo-orange.svg +210 -0
- package/assets/queen-logo-pink.svg +210 -0
- package/assets/queen-logo-purple.svg +210 -0
- package/assets/queen-logo-rose.svg +239 -0
- package/assets/queen-logo.svg +263 -0
- package/examples/batch-processing.js +58 -0
- package/examples/programmatic-server.js +58 -0
- package/examples/test-cache-multi-server.js +2 -2
- package/examples/test-connection-recovery.js +66 -0
- package/examples/test-dashboard-api.js +200 -0
- package/package.json +4 -2
- package/server.log +1 -0
- package/src/benchmark/consumer.js +207 -0
- package/src/benchmark/consumer_multi.js +216 -0
- package/src/benchmark/producer.js +75 -0
- package/src/benchmark/producer_multi.js +115 -0
- package/src/client/client.js +219 -17
- package/src/client/index.js +4 -3
- package/src/cluster-server.js +242 -0
- package/src/config.js +19 -5
- package/src/database/connection.js +42 -16
- package/src/database/poolManager.js +7 -0
- package/src/database/schema-v2.sql +194 -130
- package/src/managers/queueManagerOptimized.js +852 -933
- package/src/managers/systemEventManager.js +8 -3
- package/src/routes/messages.js +127 -57
- package/src/routes/pop.js +27 -43
- package/src/routes/resources.js +61 -27
- package/src/routes/status.js +1037 -0
- package/src/server.js +704 -642
- package/src/services/evictionService.js +57 -28
- package/src/services/retentionService.js +44 -11
- package/src/services/startupSync.js +1 -1
- package/src/test/advanced-pattern-tests.js +6 -6
- package/src/test/bus-mode-tests.js +24 -11
- package/src/test/core-tests.js +110 -0
- package/src/test/edge-case-tests.js +12 -5
- package/src/test/enterprise-tests.js +48 -15
- package/src/test/test-new.js +3 -1
- package/src/test/test.js +1 -1
- package/src/test/utils.js +1 -1
- package/src/test/window-buffer-test.js +114 -0
- package/src/utils/streaming.js +231 -0
- package/src/utils/uuid.js +2 -2
- package/src/websocket/wsServer.js +10 -3
- package/test-keepalive-v2.sh +22 -0
- package/webapp/COLOR_GUIDE.md +118 -0
- package/webapp/README.md +143 -0
- package/webapp/index.html +14 -0
- package/webapp/package-lock.json +3184 -0
- package/webapp/package.json +25 -0
- package/webapp/postcss.config.js +7 -0
- package/webapp/public/assets/queen-logo-blue.svg +210 -0
- package/webapp/public/assets/queen-logo-cyan.svg +210 -0
- package/webapp/public/assets/queen-logo-indigo.svg +210 -0
- package/webapp/public/assets/queen-logo-orange.svg +210 -0
- package/webapp/public/assets/queen-logo-pink.svg +210 -0
- package/webapp/public/assets/queen-logo-purple.svg +210 -0
- package/webapp/public/assets/queen-logo-rose.svg +239 -0
- package/webapp/public/assets/queen-logo.svg +263 -0
- package/webapp/src/App.vue +19 -0
- package/webapp/src/api/analytics.js +10 -0
- package/webapp/src/api/client.js +29 -0
- package/webapp/src/api/consumers.js +52 -0
- package/webapp/src/api/health.js +7 -0
- package/webapp/src/api/messages.js +26 -0
- package/webapp/src/api/queues.js +14 -0
- package/webapp/src/api/resources.js +8 -0
- package/webapp/src/assets/styles/main.css +357 -0
- package/webapp/src/components/analytics/AnalyticsFilters.vue +87 -0
- package/webapp/src/components/analytics/AnalyticsMetrics.vue +57 -0
- package/webapp/src/components/analytics/MessageDistributionChart.vue +111 -0
- package/webapp/src/components/analytics/MessageFlowChart.vue +173 -0
- package/webapp/src/components/analytics/TimeRangeSelector.vue +27 -0
- package/webapp/src/components/analytics/TopQueuesChart.vue +132 -0
- package/webapp/src/components/common/ConfirmDialog.vue +56 -0
- package/webapp/src/components/common/LoadingSpinner.vue +6 -0
- package/webapp/src/components/common/MetricCard.vue +43 -0
- package/webapp/src/components/common/StatusBadge.vue +45 -0
- package/webapp/src/components/dashboard/MessageStatusCard.vue +50 -0
- package/webapp/src/components/dashboard/PerformanceCard.vue +38 -0
- package/webapp/src/components/dashboard/ThroughputChart.vue +182 -0
- package/webapp/src/components/dashboard/TopQueuesTable.vue +53 -0
- package/webapp/src/components/layout/AppLayout.vue +110 -0
- package/webapp/src/components/layout/AppSidebar.vue +304 -0
- package/webapp/src/components/messages/MessageDetailPanel.vue +242 -0
- package/webapp/src/components/messages/MessageFilters.vue +101 -0
- package/webapp/src/components/queue-detail/PartitionList.vue +79 -0
- package/webapp/src/components/queue-detail/PushMessageModal.vue +175 -0
- package/webapp/src/components/queue-detail/QueueConfig.vue +63 -0
- package/webapp/src/components/queue-detail/QueueDetailHeader.vue +53 -0
- package/webapp/src/components/queue-detail/RecentMessages.vue +76 -0
- package/webapp/src/components/queues/CreateQueueModal.vue +193 -0
- package/webapp/src/components/queues/QueueFilters.vue +90 -0
- package/webapp/src/composables/useApi.js +34 -0
- package/webapp/src/composables/useTheme.js +36 -0
- package/webapp/src/main.js +11 -0
- package/webapp/src/router/index.js +42 -0
- package/webapp/src/utils/colors.js +96 -0
- package/webapp/src/utils/formatters.js +49 -0
- package/webapp/src/views/Analytics.vue +377 -0
- package/webapp/src/views/ConsumerGroups.vue +433 -0
- package/webapp/src/views/Dashboard.vue +418 -0
- package/webapp/src/views/Messages.vue +363 -0
- package/webapp/src/views/QueueDetail.vue +582 -0
- package/webapp/src/views/Queues.vue +496 -0
- package/webapp/tailwind.config.js +25 -0
- package/webapp/vite.config.js +10 -0
- package/dashboard/.vscode/extensions.json +0 -3
- package/dashboard/README.md +0 -5
- package/dashboard/index.html +0 -14
- package/dashboard/package-lock.json +0 -1458
- package/dashboard/package.json +0 -25
- package/dashboard/public/vite.svg +0 -1
- package/dashboard/src/App.vue +0 -29
- package/dashboard/src/assets/styles/main.css +0 -908
- package/dashboard/src/assets/vue.svg +0 -1
- package/dashboard/src/components/cards/MetricCard.vue +0 -298
- package/dashboard/src/components/charts/QueueDepthChart.vue +0 -276
- package/dashboard/src/components/charts/QueueLagChart.vue +0 -436
- package/dashboard/src/components/charts/ThroughputChart.vue +0 -302
- package/dashboard/src/components/common/ActivityFeed.vue +0 -251
- package/dashboard/src/components/layout/AppHeader.vue +0 -208
- package/dashboard/src/components/layout/AppLayout.vue +0 -88
- package/dashboard/src/components/layout/AppSidebar.vue +0 -261
- package/dashboard/src/main.js +0 -44
- package/dashboard/src/router.js +0 -54
- package/dashboard/src/services/api.js +0 -187
- package/dashboard/src/services/websocket.js +0 -167
- package/dashboard/src/utils/constants.js +0 -56
- package/dashboard/src/utils/helpers.js +0 -118
- package/dashboard/src/views/Analytics.vue +0 -912
- package/dashboard/src/views/Dashboard.vue +0 -906
- package/dashboard/src/views/Messages.vue +0 -437
- package/dashboard/src/views/QueueDetail.vue +0 -501
- package/dashboard/src/views/Queues.vue +0 -333
- package/dashboard/vite.config.js +0 -30
- package/src/client/queenClient.js +0 -513
- package/src/routes/analytics.js +0 -812
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<svg viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
|
|
3
|
+
<!-- Decorative sparkles -->
|
|
4
|
+
<g id="sparkles">
|
|
5
|
+
<circle cx="25" cy="30" r="1" fill="url(#sparkleGradient)" opacity="0.8">
|
|
6
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="3s" repeatCount="indefinite"/>
|
|
7
|
+
</circle>
|
|
8
|
+
<circle cx="95" cy="35" r="1.5" fill="url(#sparkleGradient)" opacity="0.6">
|
|
9
|
+
<animate attributeName="opacity" values="0.6;1;0.6" dur="2.5s" repeatCount="indefinite"/>
|
|
10
|
+
</circle>
|
|
11
|
+
<circle cx="90" cy="85" r="1" fill="url(#sparkleGradient)" opacity="0.7">
|
|
12
|
+
<animate attributeName="opacity" values="0.7;0.4;0.7" dur="2s" repeatCount="indefinite"/>
|
|
13
|
+
</circle>
|
|
14
|
+
<circle cx="30" cy="90" r="1.2" fill="url(#sparkleGradient)" opacity="0.5">
|
|
15
|
+
<animate attributeName="opacity" values="0.5;0.9;0.5" dur="2.8s" repeatCount="indefinite"/>
|
|
16
|
+
</circle>
|
|
17
|
+
</g>
|
|
18
|
+
|
|
19
|
+
<!-- Queue lines flowing (messages being managed) -->
|
|
20
|
+
<g id="queue-lines">
|
|
21
|
+
<!-- Left side queues -->
|
|
22
|
+
<g opacity="0.8">
|
|
23
|
+
<rect x="15" y="65" width="20" height="3" rx="1.5" fill="url(#queueGradient1)">
|
|
24
|
+
<animate attributeName="x" values="15;20;15" dur="4s" repeatCount="indefinite"/>
|
|
25
|
+
</rect>
|
|
26
|
+
<rect x="18" y="72" width="15" height="3" rx="1.5" fill="url(#queueGradient2)">
|
|
27
|
+
<animate attributeName="x" values="18;23;18" dur="3.5s" repeatCount="indefinite"/>
|
|
28
|
+
</rect>
|
|
29
|
+
<rect x="12" y="79" width="25" height="3" rx="1.5" fill="url(#queueGradient3)">
|
|
30
|
+
<animate attributeName="x" values="12;17;12" dur="4.5s" repeatCount="indefinite"/>
|
|
31
|
+
</rect>
|
|
32
|
+
</g>
|
|
33
|
+
|
|
34
|
+
<!-- Right side queues -->
|
|
35
|
+
<g opacity="0.8">
|
|
36
|
+
<rect x="85" y="65" width="20" height="3" rx="1.5" fill="url(#queueGradient1)">
|
|
37
|
+
<animate attributeName="x" values="85;80;85" dur="4s" repeatCount="indefinite"/>
|
|
38
|
+
</rect>
|
|
39
|
+
<rect x="87" y="72" width="15" height="3" rx="1.5" fill="url(#queueGradient2)">
|
|
40
|
+
<animate attributeName="x" values="87;82;87" dur="3.5s" repeatCount="indefinite"/>
|
|
41
|
+
</rect>
|
|
42
|
+
<rect x="83" y="79" width="25" height="3" rx="1.5" fill="url(#queueGradient3)">
|
|
43
|
+
<animate attributeName="x" values="83;78;83" dur="4.5s" repeatCount="indefinite"/>
|
|
44
|
+
</rect>
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
|
|
48
|
+
<!-- Main duck with crown -->
|
|
49
|
+
<g id="queen-duck" transform="translate(60, 60)">
|
|
50
|
+
<!-- Shadow -->
|
|
51
|
+
<ellipse cx="0" cy="35" rx="25" ry="8" fill="#000000" opacity="0.15"/>
|
|
52
|
+
|
|
53
|
+
<!-- Body with elegant curves -->
|
|
54
|
+
<path d="M -20 5 Q -25 15 -22 28 Q -18 38 -5 40 L 5 40 Q 18 38 22 28 Q 25 15 20 5 Q 15 -2 8 -3 L -8 -3 Q -15 -2 -20 5 Z"
|
|
55
|
+
fill="url(#bodyGradient)" stroke="url(#bodyStroke)" stroke-width="1.5"/>
|
|
56
|
+
|
|
57
|
+
<!-- Chest highlight -->
|
|
58
|
+
<ellipse cx="0" cy="15" rx="12" ry="15" fill="url(#chestHighlight)" opacity="0.6"/>
|
|
59
|
+
|
|
60
|
+
<!-- Wing detail left -->
|
|
61
|
+
<path d="M -18 8 Q -23 12 -22 20 Q -20 25 -15 22 Q -12 18 -13 12 Z"
|
|
62
|
+
fill="url(#wingGradient)" stroke="url(#wingStroke)" stroke-width="0.8" opacity="0.9"/>
|
|
63
|
+
|
|
64
|
+
<!-- Wing detail right -->
|
|
65
|
+
<path d="M 18 8 Q 23 12 22 20 Q 20 25 15 22 Q 12 18 13 12 Z"
|
|
66
|
+
fill="url(#wingGradient)" stroke="url(#wingStroke)" stroke-width="0.8" opacity="0.9"/>
|
|
67
|
+
|
|
68
|
+
<!-- Neck -->
|
|
69
|
+
<path d="M -5 -3 Q -6 -8 -5 -12 L 5 -12 Q 6 -8 5 -3"
|
|
70
|
+
fill="url(#neckGradient)" stroke="none"/>
|
|
71
|
+
|
|
72
|
+
<!-- Head with better proportions -->
|
|
73
|
+
<ellipse cx="0" cy="-18" rx="12" ry="13" fill="url(#headGradient)" stroke="url(#headStroke)" stroke-width="1.2"/>
|
|
74
|
+
|
|
75
|
+
<!-- Head highlight -->
|
|
76
|
+
<ellipse cx="-2" cy="-20" rx="6" ry="7" fill="url(#headHighlight)" opacity="0.5"/>
|
|
77
|
+
|
|
78
|
+
<!-- Beak with royal touch -->
|
|
79
|
+
<path d="M 8 -18 Q 14 -18 15 -17 Q 15 -15 14 -14 Q 13 -13 8 -14 Z"
|
|
80
|
+
fill="url(#beakGradient)" stroke="#FCD34D" stroke-width="0.8"/>
|
|
81
|
+
|
|
82
|
+
<!-- Eye with elegant details -->
|
|
83
|
+
<ellipse cx="4" cy="-19" rx="3" ry="3.5" fill="white"/>
|
|
84
|
+
<ellipse cx="4.5" cy="-19" rx="2" ry="2.5" fill="url(#eyeGradient)"/>
|
|
85
|
+
<circle cx="5" cy="-19.5" r="1" fill="#1F2937"/>
|
|
86
|
+
<circle cx="5.5" cy="-20" r="0.4" fill="white"/>
|
|
87
|
+
|
|
88
|
+
<!-- Eyelashes for feminine touch -->
|
|
89
|
+
<path d="M 6 -22 L 7 -23.5 M 7 -21.5 L 8.5 -22.5 M 7.5 -21 L 9 -21.5"
|
|
90
|
+
stroke="#1F2937" stroke-width="0.4" fill="none" stroke-linecap="round"/>
|
|
91
|
+
|
|
92
|
+
<!-- Cheek blush -->
|
|
93
|
+
<ellipse cx="1" cy="-15" rx="2.5" ry="1.5" fill="#FFB6C1" opacity="0.4"/>
|
|
94
|
+
|
|
95
|
+
<!-- Crown -->
|
|
96
|
+
<g id="crown" transform="translate(0, -32)">
|
|
97
|
+
<ellipse cx="0" cy="2" rx="12" ry="3" fill="#000000" opacity="0.1"/>
|
|
98
|
+
<path d="M -12 0 L -10 -8 L -6 -3 L -3 -10 L 0 -5 L 3 -10 L 6 -3 L 10 -8 L 12 0 Q 10 2 0 2 Q -10 2 -12 0 Z"
|
|
99
|
+
fill="url(#crownGradient)" stroke="url(#crownStroke)" stroke-width="1.2" stroke-linejoin="round"/>
|
|
100
|
+
<path d="M -10 0 L -8 -6 L -5 -2 L -2 -8 L 0 -4 L 2 -8 L 5 -2 L 8 -6 L 10 0"
|
|
101
|
+
fill="none" stroke="#FEF3C7" stroke-width="0.5" opacity="0.6"/>
|
|
102
|
+
<circle cx="0" cy="-2" r="2.5" fill="url(#centerJewelGradient)" stroke="#f43f5e" stroke-width="0.5"/>
|
|
103
|
+
<circle cx="0" cy="-2" r="1.5" fill="url(#jewelSparkle)" opacity="0.8"/>
|
|
104
|
+
<circle cx="-6" cy="-1" r="1.8" fill="url(#leftJewelGradient)" stroke="#fb7185" stroke-width="0.4"/>
|
|
105
|
+
<circle cx="6" cy="-1" r="1.8" fill="url(#rightJewelGradient)" stroke="#e11d48" stroke-width="0.4"/>
|
|
106
|
+
<circle cx="-3" cy="-4" r="1" fill="#fda4af" opacity="0.9"/>
|
|
107
|
+
<circle cx="3" cy="-4" r="1" fill="#fda4af" opacity="0.9"/>
|
|
108
|
+
<circle cx="0" cy="-10" r="1.2" fill="#FEF3C7"/>
|
|
109
|
+
<circle cx="-6" cy="-8" r="1" fill="#FEF3C7"/>
|
|
110
|
+
<circle cx="6" cy="-8" r="1" fill="#FEF3C7"/>
|
|
111
|
+
</g>
|
|
112
|
+
|
|
113
|
+
<!-- Tail feathers -->
|
|
114
|
+
<g id="tail" transform="translate(-22, 25)">
|
|
115
|
+
<path d="M 0 0 Q -3 3 -2 7 Q -1 9 1 8 Q 2 5 0 0" fill="url(#tailGradient)" opacity="0.8"/>
|
|
116
|
+
<path d="M 2 -1 Q -1 2 0 6 Q 1 8 3 7 Q 4 4 2 -1" fill="url(#tailGradient)" opacity="0.7"/>
|
|
117
|
+
<path d="M 4 -2 Q 1 1 2 5 Q 3 7 5 6 Q 6 3 4 -2" fill="url(#tailGradient)" opacity="0.6"/>
|
|
118
|
+
</g>
|
|
119
|
+
</g>
|
|
120
|
+
|
|
121
|
+
<defs>
|
|
122
|
+
<radialGradient id="sparkleGradient">
|
|
123
|
+
<stop offset="0%" style="stop-color:#fb7185;stop-opacity:1" />
|
|
124
|
+
<stop offset="100%" style="stop-color:#fda4af;stop-opacity:0" />
|
|
125
|
+
</radialGradient>
|
|
126
|
+
|
|
127
|
+
<linearGradient id="queueGradient1" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
128
|
+
<stop offset="0%" style="stop-color:#f43f5e;stop-opacity:0.3" />
|
|
129
|
+
<stop offset="50%" style="stop-color:#f43f5e;stop-opacity:1" />
|
|
130
|
+
<stop offset="100%" style="stop-color:#f43f5e;stop-opacity:0.3" />
|
|
131
|
+
</linearGradient>
|
|
132
|
+
|
|
133
|
+
<linearGradient id="queueGradient2" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
134
|
+
<stop offset="0%" style="stop-color:#3B82F6;stop-opacity:0.3" />
|
|
135
|
+
<stop offset="50%" style="stop-color:#3B82F6;stop-opacity:1" />
|
|
136
|
+
<stop offset="100%" style="stop-color:#3B82F6;stop-opacity:0.3" />
|
|
137
|
+
</linearGradient>
|
|
138
|
+
|
|
139
|
+
<linearGradient id="queueGradient3" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
140
|
+
<stop offset="0%" style="stop-color:#F59E0B;stop-opacity:0.3" />
|
|
141
|
+
<stop offset="50%" style="stop-color:#F59E0B;stop-opacity:1" />
|
|
142
|
+
<stop offset="100%" style="stop-color:#F59E0B;stop-opacity:0.3" />
|
|
143
|
+
</linearGradient>
|
|
144
|
+
|
|
145
|
+
<radialGradient id="bodyGradient" cx="50%" cy="30%">
|
|
146
|
+
<stop offset="0%" style="stop-color:#fecdd3;stop-opacity:1" />
|
|
147
|
+
<stop offset="70%" style="stop-color:#fda4af;stop-opacity:1" />
|
|
148
|
+
<stop offset="100%" style="stop-color:#f43f5e;stop-opacity:1" />
|
|
149
|
+
</radialGradient>
|
|
150
|
+
|
|
151
|
+
<linearGradient id="bodyStroke" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
152
|
+
<stop offset="0%" style="stop-color:#fb7185;stop-opacity:1" />
|
|
153
|
+
<stop offset="100%" style="stop-color:#e11d48;stop-opacity:1" />
|
|
154
|
+
</linearGradient>
|
|
155
|
+
|
|
156
|
+
<radialGradient id="chestHighlight">
|
|
157
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:0.8" />
|
|
158
|
+
<stop offset="100%" style="stop-color:#fff1f2;stop-opacity:0.2" />
|
|
159
|
+
</radialGradient>
|
|
160
|
+
|
|
161
|
+
<linearGradient id="wingGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
162
|
+
<stop offset="0%" style="stop-color:#fda4af;stop-opacity:1" />
|
|
163
|
+
<stop offset="100%" style="stop-color:#e11d48;stop-opacity:1" />
|
|
164
|
+
</linearGradient>
|
|
165
|
+
|
|
166
|
+
<linearGradient id="wingStroke">
|
|
167
|
+
<stop offset="0%" style="stop-color:#f43f5e;stop-opacity:1" />
|
|
168
|
+
<stop offset="100%" style="stop-color:#be123c;stop-opacity:1" />
|
|
169
|
+
</linearGradient>
|
|
170
|
+
|
|
171
|
+
<linearGradient id="neckGradient" x1="0%" y1="100%" x2="0%" y2="0%">
|
|
172
|
+
<stop offset="0%" style="stop-color:#fda4af;stop-opacity:1" />
|
|
173
|
+
<stop offset="100%" style="stop-color:#fecdd3;stop-opacity:1" />
|
|
174
|
+
</linearGradient>
|
|
175
|
+
|
|
176
|
+
<radialGradient id="headGradient" cx="40%" cy="40%">
|
|
177
|
+
<stop offset="0%" style="stop-color:#ffe4e6;stop-opacity:1" />
|
|
178
|
+
<stop offset="60%" style="stop-color:#fecdd3;stop-opacity:1" />
|
|
179
|
+
<stop offset="100%" style="stop-color:#fb7185;stop-opacity:1" />
|
|
180
|
+
</radialGradient>
|
|
181
|
+
|
|
182
|
+
<linearGradient id="headStroke">
|
|
183
|
+
<stop offset="0%" style="stop-color:#fb7185;stop-opacity:1" />
|
|
184
|
+
<stop offset="100%" style="stop-color:#f43f5e;stop-opacity:1" />
|
|
185
|
+
</linearGradient>
|
|
186
|
+
|
|
187
|
+
<radialGradient id="headHighlight">
|
|
188
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:1" />
|
|
189
|
+
<stop offset="100%" style="stop-color:#fff1f2;stop-opacity:0" />
|
|
190
|
+
</radialGradient>
|
|
191
|
+
|
|
192
|
+
<linearGradient id="beakGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
193
|
+
<stop offset="0%" style="stop-color:#FDE68A;stop-opacity:1" />
|
|
194
|
+
<stop offset="100%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
195
|
+
</linearGradient>
|
|
196
|
+
|
|
197
|
+
<radialGradient id="eyeGradient">
|
|
198
|
+
<stop offset="0%" style="stop-color:#92400E;stop-opacity:1" />
|
|
199
|
+
<stop offset="100%" style="stop-color:#451A03;stop-opacity:1" />
|
|
200
|
+
</radialGradient>
|
|
201
|
+
|
|
202
|
+
<linearGradient id="crownGradient" x1="0%" y1="100%" x2="0%" y2="0%">
|
|
203
|
+
<stop offset="0%" style="stop-color:#FDE68A;stop-opacity:1" />
|
|
204
|
+
<stop offset="50%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
205
|
+
<stop offset="100%" style="stop-color:#FEF3C7;stop-opacity:1" />
|
|
206
|
+
</linearGradient>
|
|
207
|
+
|
|
208
|
+
<linearGradient id="crownStroke">
|
|
209
|
+
<stop offset="0%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
210
|
+
<stop offset="100%" style="stop-color:#FBBF24;stop-opacity:1" />
|
|
211
|
+
</linearGradient>
|
|
212
|
+
|
|
213
|
+
<radialGradient id="centerJewelGradient">
|
|
214
|
+
<stop offset="0%" style="stop-color:#ffe4e6;stop-opacity:1" />
|
|
215
|
+
<stop offset="100%" style="stop-color:#f43f5e;stop-opacity:1" />
|
|
216
|
+
</radialGradient>
|
|
217
|
+
|
|
218
|
+
<radialGradient id="leftJewelGradient">
|
|
219
|
+
<stop offset="0%" style="stop-color:#fecdd3;stop-opacity:1" />
|
|
220
|
+
<stop offset="100%" style="stop-color:#e11d48;stop-opacity:1" />
|
|
221
|
+
</radialGradient>
|
|
222
|
+
|
|
223
|
+
<radialGradient id="rightJewelGradient">
|
|
224
|
+
<stop offset="0%" style="stop-color:#ffe4e6;stop-opacity:1" />
|
|
225
|
+
<stop offset="100%" style="stop-color:#be123c;stop-opacity:1" />
|
|
226
|
+
</radialGradient>
|
|
227
|
+
|
|
228
|
+
<radialGradient id="jewelSparkle">
|
|
229
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:1" />
|
|
230
|
+
<stop offset="100%" style="stop-color:#FFFFFF;stop-opacity:0" />
|
|
231
|
+
</radialGradient>
|
|
232
|
+
|
|
233
|
+
<linearGradient id="tailGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
234
|
+
<stop offset="0%" style="stop-color:#fb7185;stop-opacity:1" />
|
|
235
|
+
<stop offset="100%" style="stop-color:#e11d48;stop-opacity:1" />
|
|
236
|
+
</linearGradient>
|
|
237
|
+
</defs>
|
|
238
|
+
</svg>
|
|
239
|
+
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
<svg viewBox="0 0 120 120" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
|
|
3
|
+
<!-- Decorative sparkles -->
|
|
4
|
+
<g id="sparkles">
|
|
5
|
+
<circle cx="25" cy="30" r="1" fill="url(#sparkleGradient)" opacity="0.8">
|
|
6
|
+
<animate attributeName="opacity" values="0.8;0.3;0.8" dur="3s" repeatCount="indefinite"/>
|
|
7
|
+
</circle>
|
|
8
|
+
<circle cx="95" cy="35" r="1.5" fill="url(#sparkleGradient)" opacity="0.6">
|
|
9
|
+
<animate attributeName="opacity" values="0.6;1;0.6" dur="2.5s" repeatCount="indefinite"/>
|
|
10
|
+
</circle>
|
|
11
|
+
<circle cx="90" cy="85" r="1" fill="url(#sparkleGradient)" opacity="0.7">
|
|
12
|
+
<animate attributeName="opacity" values="0.7;0.4;0.7" dur="2s" repeatCount="indefinite"/>
|
|
13
|
+
</circle>
|
|
14
|
+
<circle cx="30" cy="90" r="1.2" fill="url(#sparkleGradient)" opacity="0.5">
|
|
15
|
+
<animate attributeName="opacity" values="0.5;0.9;0.5" dur="2.8s" repeatCount="indefinite"/>
|
|
16
|
+
</circle>
|
|
17
|
+
</g>
|
|
18
|
+
|
|
19
|
+
<!-- Queue lines flowing (messages being managed) -->
|
|
20
|
+
<g id="queue-lines">
|
|
21
|
+
<!-- Left side queues -->
|
|
22
|
+
<g opacity="0.8">
|
|
23
|
+
<rect x="15" y="65" width="20" height="3" rx="1.5" fill="url(#queueGradient1)">
|
|
24
|
+
<animate attributeName="x" values="15;20;15" dur="4s" repeatCount="indefinite"/>
|
|
25
|
+
</rect>
|
|
26
|
+
<rect x="18" y="72" width="15" height="3" rx="1.5" fill="url(#queueGradient2)">
|
|
27
|
+
<animate attributeName="x" values="18;23;18" dur="3.5s" repeatCount="indefinite"/>
|
|
28
|
+
</rect>
|
|
29
|
+
<rect x="12" y="79" width="25" height="3" rx="1.5" fill="url(#queueGradient3)">
|
|
30
|
+
<animate attributeName="x" values="12;17;12" dur="4.5s" repeatCount="indefinite"/>
|
|
31
|
+
</rect>
|
|
32
|
+
</g>
|
|
33
|
+
|
|
34
|
+
<!-- Right side queues -->
|
|
35
|
+
<g opacity="0.8">
|
|
36
|
+
<rect x="85" y="65" width="20" height="3" rx="1.5" fill="url(#queueGradient1)">
|
|
37
|
+
<animate attributeName="x" values="85;80;85" dur="4s" repeatCount="indefinite"/>
|
|
38
|
+
</rect>
|
|
39
|
+
<rect x="87" y="72" width="15" height="3" rx="1.5" fill="url(#queueGradient2)">
|
|
40
|
+
<animate attributeName="x" values="87;82;87" dur="3.5s" repeatCount="indefinite"/>
|
|
41
|
+
</rect>
|
|
42
|
+
<rect x="83" y="79" width="25" height="3" rx="1.5" fill="url(#queueGradient3)">
|
|
43
|
+
<animate attributeName="x" values="83;78;83" dur="4.5s" repeatCount="indefinite"/>
|
|
44
|
+
</rect>
|
|
45
|
+
</g>
|
|
46
|
+
</g>
|
|
47
|
+
|
|
48
|
+
<!-- Main duck with crown -->
|
|
49
|
+
<g id="queen-duck" transform="translate(60, 60)">
|
|
50
|
+
<!-- Shadow -->
|
|
51
|
+
<ellipse cx="0" cy="35" rx="25" ry="8" fill="#000000" opacity="0.15"/>
|
|
52
|
+
|
|
53
|
+
<!-- Body with elegant curves -->
|
|
54
|
+
<path d="M -20 5 Q -25 15 -22 28 Q -18 38 -5 40 L 5 40 Q 18 38 22 28 Q 25 15 20 5 Q 15 -2 8 -3 L -8 -3 Q -15 -2 -20 5 Z"
|
|
55
|
+
fill="url(#bodyGradient)" stroke="url(#bodyStroke)" stroke-width="1.5"/>
|
|
56
|
+
|
|
57
|
+
<!-- Chest highlight -->
|
|
58
|
+
<ellipse cx="0" cy="15" rx="12" ry="15" fill="url(#chestHighlight)" opacity="0.6"/>
|
|
59
|
+
|
|
60
|
+
<!-- Wing detail left -->
|
|
61
|
+
<path d="M -18 8 Q -23 12 -22 20 Q -20 25 -15 22 Q -12 18 -13 12 Z"
|
|
62
|
+
fill="url(#wingGradient)" stroke="url(#wingStroke)" stroke-width="0.8" opacity="0.9"/>
|
|
63
|
+
|
|
64
|
+
<!-- Wing detail right -->
|
|
65
|
+
<path d="M 18 8 Q 23 12 22 20 Q 20 25 15 22 Q 12 18 13 12 Z"
|
|
66
|
+
fill="url(#wingGradient)" stroke="url(#wingStroke)" stroke-width="0.8" opacity="0.9"/>
|
|
67
|
+
|
|
68
|
+
<!-- Neck -->
|
|
69
|
+
<path d="M -5 -3 Q -6 -8 -5 -12 L 5 -12 Q 6 -8 5 -3"
|
|
70
|
+
fill="url(#neckGradient)" stroke="none"/>
|
|
71
|
+
|
|
72
|
+
<!-- Head with better proportions -->
|
|
73
|
+
<ellipse cx="0" cy="-18" rx="12" ry="13" fill="url(#headGradient)" stroke="url(#headStroke)" stroke-width="1.2"/>
|
|
74
|
+
|
|
75
|
+
<!-- Head highlight -->
|
|
76
|
+
<ellipse cx="-2" cy="-20" rx="6" ry="7" fill="url(#headHighlight)" opacity="0.5"/>
|
|
77
|
+
|
|
78
|
+
<!-- Beak with royal touch -->
|
|
79
|
+
<path d="M 8 -18 Q 14 -18 15 -17 Q 15 -15 14 -14 Q 13 -13 8 -14 Z"
|
|
80
|
+
fill="url(#beakGradient)" stroke="#FCD34D" stroke-width="0.8"/>
|
|
81
|
+
|
|
82
|
+
<!-- Eye with elegant details -->
|
|
83
|
+
<ellipse cx="4" cy="-19" rx="3" ry="3.5" fill="white"/>
|
|
84
|
+
<ellipse cx="4.5" cy="-19" rx="2" ry="2.5" fill="url(#eyeGradient)"/>
|
|
85
|
+
<circle cx="5" cy="-19.5" r="1" fill="#1F2937"/>
|
|
86
|
+
<circle cx="5.5" cy="-20" r="0.4" fill="white"/> <!-- Eye sparkle -->
|
|
87
|
+
|
|
88
|
+
<!-- Eyelashes for feminine touch -->
|
|
89
|
+
<path d="M 6 -22 L 7 -23.5 M 7 -21.5 L 8.5 -22.5 M 7.5 -21 L 9 -21.5"
|
|
90
|
+
stroke="#1F2937" stroke-width="0.4" fill="none" stroke-linecap="round"/>
|
|
91
|
+
|
|
92
|
+
<!-- Cheek blush -->
|
|
93
|
+
<ellipse cx="1" cy="-15" rx="2.5" ry="1.5" fill="#FFB6C1" opacity="0.4"/>
|
|
94
|
+
|
|
95
|
+
<!-- Crown - more elegant and detailed -->
|
|
96
|
+
<g id="crown" transform="translate(0, -32)">
|
|
97
|
+
<!-- Crown shadow -->
|
|
98
|
+
<ellipse cx="0" cy="2" rx="12" ry="3" fill="#000000" opacity="0.1"/>
|
|
99
|
+
|
|
100
|
+
<!-- Main crown shape with better design -->
|
|
101
|
+
<path d="M -12 0 L -10 -8 L -6 -3 L -3 -10 L 0 -5 L 3 -10 L 6 -3 L 10 -8 L 12 0 Q 10 2 0 2 Q -10 2 -12 0 Z"
|
|
102
|
+
fill="url(#crownGradient)" stroke="url(#crownStroke)" stroke-width="1.2" stroke-linejoin="round"/>
|
|
103
|
+
|
|
104
|
+
<!-- Crown inner detail -->
|
|
105
|
+
<path d="M -10 0 L -8 -6 L -5 -2 L -2 -8 L 0 -4 L 2 -8 L 5 -2 L 8 -6 L 10 0"
|
|
106
|
+
fill="none" stroke="#FEF3C7" stroke-width="0.5" opacity="0.6"/>
|
|
107
|
+
|
|
108
|
+
<!-- Center jewel (main) -->
|
|
109
|
+
<circle cx="0" cy="-2" r="2.5" fill="url(#centerJewelGradient)" stroke="#10B981" stroke-width="0.5"/>
|
|
110
|
+
<circle cx="0" cy="-2" r="1.5" fill="url(#jewelSparkle)" opacity="0.8"/>
|
|
111
|
+
|
|
112
|
+
<!-- Side jewels -->
|
|
113
|
+
<circle cx="-6" cy="-1" r="1.8" fill="url(#leftJewelGradient)" stroke="#059669" stroke-width="0.4"/>
|
|
114
|
+
<circle cx="6" cy="-1" r="1.8" fill="url(#rightJewelGradient)" stroke="#047857" stroke-width="0.4"/>
|
|
115
|
+
|
|
116
|
+
<!-- Small decorative gems -->
|
|
117
|
+
<circle cx="-3" cy="-4" r="1" fill="#6EE7B7" opacity="0.9"/>
|
|
118
|
+
<circle cx="3" cy="-4" r="1" fill="#6EE7B7" opacity="0.9"/>
|
|
119
|
+
|
|
120
|
+
<!-- Crown peaks -->
|
|
121
|
+
<circle cx="0" cy="-10" r="1.2" fill="#FEF3C7"/>
|
|
122
|
+
<circle cx="-6" cy="-8" r="1" fill="#FEF3C7"/>
|
|
123
|
+
<circle cx="6" cy="-8" r="1" fill="#FEF3C7"/>
|
|
124
|
+
</g>
|
|
125
|
+
|
|
126
|
+
<!-- Tail feathers -->
|
|
127
|
+
<g id="tail" transform="translate(-22, 25)">
|
|
128
|
+
<path d="M 0 0 Q -3 3 -2 7 Q -1 9 1 8 Q 2 5 0 0" fill="url(#tailGradient)" opacity="0.8"/>
|
|
129
|
+
<path d="M 2 -1 Q -1 2 0 6 Q 1 8 3 7 Q 4 4 2 -1" fill="url(#tailGradient)" opacity="0.7"/>
|
|
130
|
+
<path d="M 4 -2 Q 1 1 2 5 Q 3 7 5 6 Q 6 3 4 -2" fill="url(#tailGradient)" opacity="0.6"/>
|
|
131
|
+
</g>
|
|
132
|
+
</g>
|
|
133
|
+
|
|
134
|
+
<!-- Gradient definitions -->
|
|
135
|
+
<defs>
|
|
136
|
+
<!-- Sparkle gradient -->
|
|
137
|
+
<radialGradient id="sparkleGradient">
|
|
138
|
+
<stop offset="0%" style="stop-color:#34D399;stop-opacity:1" />
|
|
139
|
+
<stop offset="100%" style="stop-color:#6EE7B7;stop-opacity:0" />
|
|
140
|
+
</radialGradient>
|
|
141
|
+
|
|
142
|
+
<!-- Queue gradients -->
|
|
143
|
+
<linearGradient id="queueGradient1" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
144
|
+
<stop offset="0%" style="stop-color:#10B981;stop-opacity:0.3" />
|
|
145
|
+
<stop offset="50%" style="stop-color:#10B981;stop-opacity:1" />
|
|
146
|
+
<stop offset="100%" style="stop-color:#10B981;stop-opacity:0.3" />
|
|
147
|
+
</linearGradient>
|
|
148
|
+
|
|
149
|
+
<linearGradient id="queueGradient2" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
150
|
+
<stop offset="0%" style="stop-color:#3B82F6;stop-opacity:0.3" />
|
|
151
|
+
<stop offset="50%" style="stop-color:#3B82F6;stop-opacity:1" />
|
|
152
|
+
<stop offset="100%" style="stop-color:#3B82F6;stop-opacity:0.3" />
|
|
153
|
+
</linearGradient>
|
|
154
|
+
|
|
155
|
+
<linearGradient id="queueGradient3" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
156
|
+
<stop offset="0%" style="stop-color:#F59E0B;stop-opacity:0.3" />
|
|
157
|
+
<stop offset="50%" style="stop-color:#F59E0B;stop-opacity:1" />
|
|
158
|
+
<stop offset="100%" style="stop-color:#F59E0B;stop-opacity:0.3" />
|
|
159
|
+
</linearGradient>
|
|
160
|
+
|
|
161
|
+
<!-- Body gradients -->
|
|
162
|
+
<radialGradient id="bodyGradient" cx="50%" cy="30%">
|
|
163
|
+
<stop offset="0%" style="stop-color:#A7F3D0;stop-opacity:1" />
|
|
164
|
+
<stop offset="70%" style="stop-color:#6EE7B7;stop-opacity:1" />
|
|
165
|
+
<stop offset="100%" style="stop-color:#10B981;stop-opacity:1" />
|
|
166
|
+
</radialGradient>
|
|
167
|
+
|
|
168
|
+
<linearGradient id="bodyStroke" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
169
|
+
<stop offset="0%" style="stop-color:#34D399;stop-opacity:1" />
|
|
170
|
+
<stop offset="100%" style="stop-color:#059669;stop-opacity:1" />
|
|
171
|
+
</linearGradient>
|
|
172
|
+
|
|
173
|
+
<radialGradient id="chestHighlight">
|
|
174
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:0.8" />
|
|
175
|
+
<stop offset="100%" style="stop-color:#D1FAE5;stop-opacity:0.2" />
|
|
176
|
+
</radialGradient>
|
|
177
|
+
|
|
178
|
+
<!-- Wing gradients -->
|
|
179
|
+
<linearGradient id="wingGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
180
|
+
<stop offset="0%" style="stop-color:#6EE7B7;stop-opacity:1" />
|
|
181
|
+
<stop offset="100%" style="stop-color:#059669;stop-opacity:1" />
|
|
182
|
+
</linearGradient>
|
|
183
|
+
|
|
184
|
+
<linearGradient id="wingStroke">
|
|
185
|
+
<stop offset="0%" style="stop-color:#10B981;stop-opacity:1" />
|
|
186
|
+
<stop offset="100%" style="stop-color:#047857;stop-opacity:1" />
|
|
187
|
+
</linearGradient>
|
|
188
|
+
|
|
189
|
+
<!-- Neck gradient -->
|
|
190
|
+
<linearGradient id="neckGradient" x1="0%" y1="100%" x2="0%" y2="0%">
|
|
191
|
+
<stop offset="0%" style="stop-color:#6EE7B7;stop-opacity:1" />
|
|
192
|
+
<stop offset="100%" style="stop-color:#86EFAC;stop-opacity:1" />
|
|
193
|
+
</linearGradient>
|
|
194
|
+
|
|
195
|
+
<!-- Head gradients -->
|
|
196
|
+
<radialGradient id="headGradient" cx="40%" cy="40%">
|
|
197
|
+
<stop offset="0%" style="stop-color:#BBF7D0;stop-opacity:1" />
|
|
198
|
+
<stop offset="60%" style="stop-color:#86EFAC;stop-opacity:1" />
|
|
199
|
+
<stop offset="100%" style="stop-color:#34D399;stop-opacity:1" />
|
|
200
|
+
</radialGradient>
|
|
201
|
+
|
|
202
|
+
<linearGradient id="headStroke">
|
|
203
|
+
<stop offset="0%" style="stop-color:#34D399;stop-opacity:1" />
|
|
204
|
+
<stop offset="100%" style="stop-color:#10B981;stop-opacity:1" />
|
|
205
|
+
</linearGradient>
|
|
206
|
+
|
|
207
|
+
<radialGradient id="headHighlight">
|
|
208
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:1" />
|
|
209
|
+
<stop offset="100%" style="stop-color:#F0FDF4;stop-opacity:0" />
|
|
210
|
+
</radialGradient>
|
|
211
|
+
|
|
212
|
+
<!-- Beak gradient -->
|
|
213
|
+
<linearGradient id="beakGradient" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
214
|
+
<stop offset="0%" style="stop-color:#FDE68A;stop-opacity:1" />
|
|
215
|
+
<stop offset="100%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
216
|
+
</linearGradient>
|
|
217
|
+
|
|
218
|
+
<!-- Eye gradient -->
|
|
219
|
+
<radialGradient id="eyeGradient">
|
|
220
|
+
<stop offset="0%" style="stop-color:#92400E;stop-opacity:1" />
|
|
221
|
+
<stop offset="100%" style="stop-color:#451A03;stop-opacity:1" />
|
|
222
|
+
</radialGradient>
|
|
223
|
+
|
|
224
|
+
<!-- Crown gradients -->
|
|
225
|
+
<linearGradient id="crownGradient" x1="0%" y1="100%" x2="0%" y2="0%">
|
|
226
|
+
<stop offset="0%" style="stop-color:#FDE68A;stop-opacity:1" />
|
|
227
|
+
<stop offset="50%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
228
|
+
<stop offset="100%" style="stop-color:#FEF3C7;stop-opacity:1" />
|
|
229
|
+
</linearGradient>
|
|
230
|
+
|
|
231
|
+
<linearGradient id="crownStroke">
|
|
232
|
+
<stop offset="0%" style="stop-color:#FCD34D;stop-opacity:1" />
|
|
233
|
+
<stop offset="100%" style="stop-color:#FBBF24;stop-opacity:1" />
|
|
234
|
+
</linearGradient>
|
|
235
|
+
|
|
236
|
+
<!-- Jewel gradients -->
|
|
237
|
+
<radialGradient id="centerJewelGradient">
|
|
238
|
+
<stop offset="0%" style="stop-color:#D1FAE5;stop-opacity:1" />
|
|
239
|
+
<stop offset="100%" style="stop-color:#10B981;stop-opacity:1" />
|
|
240
|
+
</radialGradient>
|
|
241
|
+
|
|
242
|
+
<radialGradient id="leftJewelGradient">
|
|
243
|
+
<stop offset="0%" style="stop-color:#A7F3D0;stop-opacity:1" />
|
|
244
|
+
<stop offset="100%" style="stop-color:#059669;stop-opacity:1" />
|
|
245
|
+
</radialGradient>
|
|
246
|
+
|
|
247
|
+
<radialGradient id="rightJewelGradient">
|
|
248
|
+
<stop offset="0%" style="stop-color:#D1FAE5;stop-opacity:1" />
|
|
249
|
+
<stop offset="100%" style="stop-color:#047857;stop-opacity:1" />
|
|
250
|
+
</radialGradient>
|
|
251
|
+
|
|
252
|
+
<radialGradient id="jewelSparkle">
|
|
253
|
+
<stop offset="0%" style="stop-color:#FFFFFF;stop-opacity:1" />
|
|
254
|
+
<stop offset="100%" style="stop-color:#FFFFFF;stop-opacity:0" />
|
|
255
|
+
</radialGradient>
|
|
256
|
+
|
|
257
|
+
<!-- Tail gradient -->
|
|
258
|
+
<linearGradient id="tailGradient" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
259
|
+
<stop offset="0%" style="stop-color:#34D399;stop-opacity:1" />
|
|
260
|
+
<stop offset="100%" style="stop-color:#059669;stop-opacity:1" />
|
|
261
|
+
</linearGradient>
|
|
262
|
+
</defs>
|
|
263
|
+
</svg>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Queen } from '../src/client/client.js';
|
|
2
|
+
|
|
3
|
+
const q = new Queen({ baseUrl: 'http://localhost:6632' });
|
|
4
|
+
|
|
5
|
+
await q.queue('demo-queue', {
|
|
6
|
+
leaseTime: 30,
|
|
7
|
+
retryLimit: 3
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
console.log('=== Example 1: take() - Individual message processing ===');
|
|
11
|
+
let count1 = 0;
|
|
12
|
+
for await (const message of q.take('demo-queue', {
|
|
13
|
+
batch: 10, // Fetch 10 at a time internally
|
|
14
|
+
limit: 25, // Process 25 total
|
|
15
|
+
wait: false
|
|
16
|
+
})) {
|
|
17
|
+
console.log(`Message ${++count1}:`, message.data);
|
|
18
|
+
await q.ack(message);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
console.log('\n=== Example 2: takeBatch() - Batch processing ===');
|
|
22
|
+
let count2 = 0;
|
|
23
|
+
for await (const messages of q.takeBatch('demo-queue', {
|
|
24
|
+
batch: 10, // Fetch 10 at a time
|
|
25
|
+
limit: 25, // Process 25 total (across batches)
|
|
26
|
+
wait: false
|
|
27
|
+
})) {
|
|
28
|
+
console.log(`Batch ${++count2}: ${messages.length} messages`);
|
|
29
|
+
|
|
30
|
+
// Process entire batch
|
|
31
|
+
for (const msg of messages) {
|
|
32
|
+
console.log(` - ${msg.data}`);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Acknowledge entire batch at once
|
|
36
|
+
await q.ack(messages);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
console.log('\n=== Example 3: High-throughput batch processing ===');
|
|
40
|
+
let totalProcessed = 0;
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
|
|
43
|
+
for await (const messages of q.takeBatch('demo-queue', {
|
|
44
|
+
batch: 1000, // Large batches for throughput
|
|
45
|
+
wait: true, // Long polling
|
|
46
|
+
idleTimeout: 5000 // Exit after 5s of no messages
|
|
47
|
+
})) {
|
|
48
|
+
totalProcessed += messages.length;
|
|
49
|
+
await q.ack(messages);
|
|
50
|
+
|
|
51
|
+
const rate = totalProcessed / ((Date.now() - startTime) / 1000);
|
|
52
|
+
console.log(`Processed ${messages.length} | Total: ${totalProcessed} | Rate: ${rate.toFixed(0)} msg/s`);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
console.log(`\nCompleted: ${totalProcessed} messages`);
|
|
56
|
+
|
|
57
|
+
await q.close();
|
|
58
|
+
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Starting Queen Server Programmatically
|
|
3
|
+
*
|
|
4
|
+
* This example shows how to import and run the Queen server
|
|
5
|
+
* directly from your code, rather than running it as a separate process.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { QueenServer, Queen } from 'queen-mq';
|
|
9
|
+
|
|
10
|
+
// Start the server programmatically
|
|
11
|
+
console.log('Starting Queen Server...');
|
|
12
|
+
|
|
13
|
+
const server = await QueenServer({
|
|
14
|
+
port: 3000,
|
|
15
|
+
host: '127.0.0.1'
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
console.log(`✅ Server started at http://${server.host}:${server.port}`);
|
|
19
|
+
|
|
20
|
+
// Now you can use the client in the same process
|
|
21
|
+
const client = new Queen({
|
|
22
|
+
servers: [`http://${server.host}:${server.port}`]
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Create a queue
|
|
26
|
+
await client.push({
|
|
27
|
+
queue: 'example-queue',
|
|
28
|
+
items: [
|
|
29
|
+
{ data: { message: 'Hello from programmatic server!' } }
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
console.log('✅ Message pushed to queue');
|
|
34
|
+
|
|
35
|
+
// Pop a message
|
|
36
|
+
const result = await client.pop({
|
|
37
|
+
queue: 'example-queue'
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
console.log('✅ Message received:', result.messages[0]?.data);
|
|
41
|
+
|
|
42
|
+
// Acknowledge the message
|
|
43
|
+
if (result.messages.length > 0) {
|
|
44
|
+
await client.ack({
|
|
45
|
+
transactionId: result.messages[0].transactionId,
|
|
46
|
+
status: 'completed'
|
|
47
|
+
});
|
|
48
|
+
console.log('✅ Message acknowledged');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Graceful shutdown on SIGINT
|
|
52
|
+
process.on('SIGINT', async () => {
|
|
53
|
+
console.log('\nShutting down...');
|
|
54
|
+
await server.shutdown('SIGINT');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log('\n📝 Server is running. Press Ctrl+C to stop.');
|
|
58
|
+
|
|
@@ -120,7 +120,7 @@ async function testCacheConsistency() {
|
|
|
120
120
|
log(`Server 1 returned ${pop1.messages?.length || 0} messages`, servers[0]);
|
|
121
121
|
if (pop1.messages && pop1.messages.length > 0) {
|
|
122
122
|
for (const msg of pop1.messages) {
|
|
123
|
-
log(` - Message: ${JSON.stringify(msg.
|
|
123
|
+
log(` - Message: ${JSON.stringify(msg.data)}`, servers[0]);
|
|
124
124
|
await sessionClient1.ack(msg.transactionId, 'completed');
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -140,7 +140,7 @@ async function testCacheConsistency() {
|
|
|
140
140
|
log(`Server 2 returned ${pop2.messages?.length || 0} messages`, servers[1]);
|
|
141
141
|
if (pop2.messages && pop2.messages.length > 0) {
|
|
142
142
|
for (const msg of pop2.messages) {
|
|
143
|
-
log(` - Message: ${JSON.stringify(msg.
|
|
143
|
+
log(` - Message: ${JSON.stringify(msg.data)}`, servers[1]);
|
|
144
144
|
await sessionClient2.ack(msg.transactionId, 'completed');
|
|
145
145
|
}
|
|
146
146
|
}
|