Skip to content

Commit 92a4d2c

Browse files
Merge pull request #13910 from rabbitmq/ik-queues-with-plugins-mgmt
Queues with plugins - Managment UI parts
2 parents c29fc82 + 180e7b1 commit 92a4d2c

22 files changed

+640
-419
lines changed

deps/rabbitmq_management/priv/www/js/global.js

Lines changed: 219 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ var HELP = {
223223
'Optional replacement routing key to use when a message is dead-lettered. If this is not set, the message\'s original routing key will be used.<br/>(Sets the "<a target="_blank" href="https://rabbitmq.com/dlx.html">x-dead-letter-routing-key</a>" argument.)',
224224

225225
'queue-dead-letter-strategy':
226-
'Valid values are <code>at-most-once</code> or <code>at-least-once</code>. It defaults to <code>at-most-once</code>. This setting is understood only by quorum queues. If <code>at-least-once</code> is set, <code>Overflow behaviour</code> must be set to <code>reject-publish</code>. Otherwise, dead letter strategy will fall back to <code>at-most-once</code>.',
226+
'Valid values are <code>at-most-once</code> or <code>at-least-once</code>. It defaults to <code>at-most-once</code>. If <code>at-least-once</code> is set, <code>Overflow behaviour</code> must be set to <code>reject-publish</code>. Otherwise, dead letter strategy will fall back to <code>at-most-once</code>.',
227227

228228
'queue-single-active-consumer':
229229
'If set, makes sure only one consumer at a time consumes from the queue and fails over to another registered consumer in case the active one is cancelled or dies.<br/>(Sets the "<a target="_blank" href="https://rabbitmq.com/consumers.html#single-active-consumer">x-single-active-consumer</a>" argument.)',
@@ -235,7 +235,10 @@ var HELP = {
235235
'Sets the data retention for stream queues in time units </br>(Y=Years, M=Months, D=Days, h=hours, m=minutes, s=seconds).<br/>E.g. "1h" configures the stream to only keep the last 1 hour of received messages.</br></br>(Sets the x-max-age argument.)',
236236

237237
'queue-overflow':
238-
'Sets the <a target="_blank" href="https://www.rabbitmq.com/maxlength.html#overflow-behaviour">queue overflow behaviour</a>. This determines what happens to messages when the maximum length of a queue is reached. Valid values are <code>drop-head</code>, <code>reject-publish</code> or <code>reject-publish-dlx</code>. The quorum queue type only supports <code>drop-head</code> and <code>reject-publish</code>.',
238+
'Sets the <a target="_blank" href="https://www.rabbitmq.com/maxlength.html#overflow-behaviour">queue overflow behaviour</a>. This determines what happens to messages when the maximum length of a queue is reached. Valid values are <code>drop-head</code>, <code>reject-publish</code> or <code>reject-publish-dlx</code>',
239+
240+
'quorum-queue-overflow':
241+
'Sets the <a target="_blank" href="https://www.rabbitmq.com/maxlength.html#overflow-behaviour">queue overflow behaviour</a>. This determines what happens to messages when the maximum length of a queue is reached. Valid values for quorum queues are <code>drop-head</code> and <code>reject-publish</code>.',
239242

240243
'queue-master-locator':
241244
'Deprecated: please use `queue-leader-locator` instead. <a target="_blank" href="https://www.rabbitmq.com/docs/clustering#replica-placement">Controls which node the queue will be running on.</a>',
@@ -887,3 +890,217 @@ var chart_data = {};
887890
var last_page_out_of_range_error = 0;
888891

889892
var oauth;
893+
894+
895+
///////////////////////////////////////////////////////////////////////////
896+
// //
897+
// Queue types //
898+
// //
899+
///////////////////////////////////////////////////////////////////////////
900+
901+
/// this queue types are very well known to the server, at the very least
902+
/// this collection must be validated in terms of matching server queue
903+
/// types registry. I hope I will have time for this.
904+
var QUEUE_TYPE = function (queue) {
905+
return QUEUE_TYPE[get_queue_type(queue)];
906+
}
907+
// TODO: while this allows for custom queues
908+
// the proper way is to follow single source of truth
909+
// and generate most of this on the server from queue type metadata
910+
// including replacing tmpl's with data-driven generators
911+
// For example server knows policy_apply_to for each queue
912+
// and it knows what extra agruments each queue type accepts.
913+
// So for the latter case we dont' need a template that lists
914+
// queue args. We need iterator over server-supplied object.
915+
QUEUE_TYPE["default"] = {
916+
label: "Default",
917+
params: {},
918+
policy_apply_to: "classic_queue",
919+
actions: {
920+
get_message: true,
921+
purge: true
922+
},
923+
tmpl: {
924+
"arguments" : "classic-queue-arguments",
925+
// TODO: this must be generated from js objects of course.
926+
// and then those objects must be rendered by the server
927+
"user_policy_arguments": "classic-queue-user-policy-arguments",
928+
"operator_policy_arguments": "classic-queue-operator-policy-arguments",
929+
"list" : "classic-queue-list",
930+
"stats" : "classic-queue-stats",
931+
"node_details" : "classic-queue-node-details"
932+
}
933+
};
934+
935+
QUEUE_TYPE["classic"] = {
936+
label: "Classic",
937+
params: {},
938+
policy_apply_to: "classic_queue",
939+
actions: {
940+
get_message: true,
941+
purge: true
942+
},
943+
tmpl: {
944+
"arguments" : "classic-queue-arguments",
945+
"user_policy_arguments": "classic-queue-user-policy-arguments",
946+
"operator_policy_arguments": "classic-queue-operator-policy-arguments",
947+
"list" : "classic-queue-list",
948+
"stats" : "classic-queue-stats",
949+
"node_details" : "classic-queue-node-details"
950+
}
951+
};
952+
953+
QUEUE_TYPE["quorum"] = {
954+
label: "Quorum",
955+
params: {
956+
'durable': true,
957+
'auto_delete': false
958+
},
959+
policy_apply_to: "quorum_queues",
960+
actions: {
961+
get_message: true,
962+
purge: true
963+
},
964+
tmpl: {
965+
"arguments" : "quorum-queue-arguments",
966+
"user_policy_arguments": "quorum-queue-user-policy-arguments",
967+
"operator_policy_arguments": "quorum-queue-operator-policy-arguments",
968+
"list" : "quorum-queue-list",
969+
"stats": "quorum-queue-stats",
970+
"node_details" : "quorum-queue-node-details"
971+
}
972+
};
973+
974+
QUEUE_TYPE["stream"] = {
975+
label: "Stream",
976+
params: {
977+
'durable': true,
978+
'auto_delete': false
979+
},
980+
policy_apply_to: "streams",
981+
actions: {
982+
get_message: false,
983+
purge: false
984+
},
985+
tmpl: {
986+
"arguments" : "stream-queue-arguments",
987+
"user_policy_arguments": "quorum-queue-user-policy-arguments",
988+
"operator_policy_arguments": "stream-queue-operator-policy-arguments",
989+
"list" : "stream-queue-list",
990+
"stats" : "stream-queue-stats",
991+
"node_details" : "stream-queue-node-details"
992+
}
993+
};
994+
995+
// here I'll shortcut for now and let it be like that
996+
// other queue types can inject themlves where they want.
997+
// since the 'sections' object will likely keep key insertion
998+
// order custom keys for queue type will be coming last.
999+
1000+
// maybe add helper functions?
1001+
var MEMORY_STATISTICS = {
1002+
sections: {'queue_procs' : ['classic', 'Classic queues'],
1003+
'quorum_queue_procs' : ['quorum', 'Quorum queues'],
1004+
'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
1005+
'stream_queue_procs' : ['stream', 'Stream queues'],
1006+
'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
1007+
'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
1008+
'binary' : ['binary', 'Binaries'],
1009+
'connection_readers' : ['conn', 'Connection readers'],
1010+
'connection_writers' : ['conn', 'Connection writers'],
1011+
'connection_channels' : ['conn', 'Connection channels'],
1012+
'connection_other' : ['conn', 'Connections (other)'],
1013+
'mnesia' : ['table', 'Mnesia'],
1014+
'msg_index' : ['table', 'Message store index'],
1015+
'mgmt_db' : ['table', 'Management database'],
1016+
'quorum_ets' : ['table', 'Quorum queue ETS tables'],
1017+
'other_ets' : ['table', 'Other ETS tables'],
1018+
'plugins' : ['proc', 'Plugins'],
1019+
'other_proc' : ['proc', 'Other process memory'],
1020+
'code' : ['system', 'Code'],
1021+
'atom' : ['system', 'Atoms'],
1022+
'other_system' : ['system', 'Other system'],
1023+
'allocated_unused' : ['unused', 'Allocated unused'],
1024+
'reserved_unallocated': ['unused', 'Unallocated reserved by the OS']},
1025+
keys: [[{name: 'Classic Queues', colour: 'classic',
1026+
keys: [['queue_procs', 'queues']]},
1027+
{name: 'Quorum Queues', colour: 'quorum',
1028+
keys: [['quorum_queue_procs','quorum'],
1029+
['quorum_queue_dlx_procs', 'dead letter workers']]},
1030+
{name: 'Streams', colour: 'stream',
1031+
keys: [['stream_queue_procs', 'stream'],
1032+
['stream_queue_replica_reader_procs', 'stream replica reader'],
1033+
['stream_queue_coordinator_procs', 'stream coordinator']]},
1034+
{name: 'Binaries', colour: 'binary',
1035+
keys: [['binary', '']]}],
1036+
1037+
[{name: 'Connections', colour: 'conn',
1038+
keys: [['connection_readers', 'readers'],
1039+
['connection_writers', 'writers'],
1040+
['connection_channels', 'channels'],
1041+
['connection_other', 'other']]}],
1042+
1043+
[{name: 'Tables', colour: 'table',
1044+
keys: [['mnesia', 'internal database tables'],
1045+
['msg_index', 'message store index'],
1046+
['mgmt_db', 'management database'],
1047+
['quorum_ets', 'quorum queue tables'],
1048+
['other_ets', 'other']]}],
1049+
1050+
[{name: 'Processes', colour: 'proc',
1051+
keys: [['plugins', 'plugins'],
1052+
['metadata_store', 'metadata store'],
1053+
['other_proc', 'other']]},
1054+
{name: 'System', colour: 'system',
1055+
keys: [['code', 'code'],
1056+
['atom', 'atoms'],
1057+
['other_system', 'other']
1058+
]}],
1059+
1060+
[{name: 'Preallocated memory', colour: 'unused',
1061+
keys: [['allocated_unused', 'preallocated by runtime, unused'],
1062+
['reserved_unallocated', 'unallocated, reserved by the OS']]}]]
1063+
}
1064+
1065+
var BINARY_STATISTICS = {
1066+
sections: {'queue_procs' : ['classic', 'Classic queues'],
1067+
'quorum_queue_procs' : ['quorum', 'Quorum queues'],
1068+
'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
1069+
'stream_queue_procs' : ['stream', 'Stream queues'],
1070+
'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
1071+
'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
1072+
'connection_readers' : ['conn', 'Connection readers'],
1073+
'connection_writers' : ['conn', 'Connection writers'],
1074+
'connection_channels' : ['conn', 'Connection channels'],
1075+
'connection_other' : ['conn', 'Connections (other)'],
1076+
'msg_index' : ['table', 'Message store index'],
1077+
'mgmt_db' : ['table', 'Management database'],
1078+
'plugins' : ['proc', 'Plugins'],
1079+
'metadata_store' : ['metadata_store', 'Metadata store'],
1080+
'other' : ['system', 'Other binary references']},
1081+
key: [[{name: 'Classic Queues', colour: 'classic',
1082+
keys: [['queue_procs', 'queues']]},
1083+
{name: 'Quorum Queues', colour: 'quorum',
1084+
keys: [['quorum_queue_procs', 'quorum'],
1085+
['quorum_queue_dlx_procs', 'dead letter workers']]},
1086+
{name: 'Streams', colour: 'stream',
1087+
keys: [['stream_queue_procs', 'stream'],
1088+
['stream_queue_replica_reader_procs', 'stream replica reader'],
1089+
['stream_queue_coordinator_procs', 'stream coordinator']]}],
1090+
1091+
[{name: 'Connections', colour: 'conn',
1092+
keys: [['connection_readers', 'readers'],
1093+
['connection_writers', 'writers'],
1094+
['connection_channels', 'channels'],
1095+
['connection_other', 'other']]}],
1096+
1097+
[{name: 'Tables', colour: 'table',
1098+
keys: [['msg_index', 'message store index'],
1099+
['mgmt_db', 'management database']]}],
1100+
1101+
[{name: 'Processes', colour: 'proc',
1102+
keys: [['plugins', 'plugins'],
1103+
['metadata_store', 'metadata store']]},
1104+
{name: 'System', colour: 'system',
1105+
keys: [['other', 'other']]}]]
1106+
};

deps/rabbitmq_management/priv/www/js/main.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,11 +1578,8 @@ function collapse_multifields(params0) {
15781578
if (queue_type != 'default') {
15791579
params['arguments']['x-queue-type'] = queue_type;
15801580
}
1581-
if (queue_type == 'quorum' ||
1582-
queue_type == 'stream') {
1583-
params['durable'] = true;
1584-
params['auto_delete'] = false;
1585-
}
1581+
1582+
params = Object.assign(params, QUEUE_TYPE[queue_type].params)
15861583
}
15871584
return params;
15881585
}

deps/rabbitmq_management/priv/www/js/tmpl/binary.ejs

Lines changed: 8 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,56 +5,14 @@
55
Binary statistics not available.
66
</p>
77
<% } else { %>
8-
<%
9-
var sections = {'queue_procs' : ['classic', 'Classic queues'],
10-
'quorum_queue_procs' : ['quorum', 'Quorum queues'],
11-
'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
12-
'stream_queue_procs' : ['stream', 'Stream queues'],
13-
'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
14-
'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
15-
'connection_readers' : ['conn', 'Connection readers'],
16-
'connection_writers' : ['conn', 'Connection writers'],
17-
'connection_channels' : ['conn', 'Connection channels'],
18-
'connection_other' : ['conn', 'Connections (other)'],
19-
'msg_index' : ['table', 'Message store index'],
20-
'mgmt_db' : ['table', 'Management database'],
21-
'plugins' : ['proc', 'Plugins'],
22-
'metadata_store' : ['metadata_store', 'Metadata store'],
23-
'other' : ['system', 'Other binary references']};
24-
var total_out = [];
25-
%>
26-
<%= format('memory-bar', {sections: sections, memory: binary, total_out: total_out}) %>
27-
<span class="clear">&nbsp;</span>
28-
<div class="box">
29-
<%
30-
var key = [[{name: 'Classic Queues', colour: 'classic',
31-
keys: [['queue_procs', 'queues']]},
32-
{name: 'Quorum Queues', colour: 'quorum',
33-
keys: [['quorum_queue_procs', 'quorum'],
34-
['quorum_queue_dlx_procs', 'dead letter workers']]},
35-
{name: 'Streams', colour: 'stream',
36-
keys: [['stream_queue_procs', 'stream'],
37-
['stream_queue_replica_reader_procs', 'stream replica reader'],
38-
['stream_queue_coordinator_procs', 'stream coordinator']]}],
39-
40-
[{name: 'Connections', colour: 'conn',
41-
keys: [['connection_readers', 'readers'],
42-
['connection_writers', 'writers'],
43-
['connection_channels', 'channels'],
44-
['connection_other', 'other']]}],
45-
46-
[{name: 'Tables', colour: 'table',
47-
keys: [['msg_index', 'message store index'],
48-
['mgmt_db', 'management database']]}],
49-
50-
[{name: 'Processes', colour: 'proc',
51-
keys: [['plugins', 'plugins'],
52-
['metadata_store', 'metadata store']]},
53-
{name: 'System', colour: 'system',
54-
keys: [['other', 'other']]}]];
55-
%>
56-
<%= format('memory-table', {key: key, memory: binary}) %>
57-
</div>
8+
<%
9+
var total_out = [];
10+
%>
11+
<%= format('memory-bar', {sections: BINARY_STATISTICS.sections, memory: binary, total_out: total_out}) %>
12+
<span class="clear">&nbsp;</span>
13+
<div class="box">
14+
<%= format('memory-table', {key: BINARY_STATISTICS. key, memory: binary}) %>
15+
</div>
5816
5917
<div class="memory-info">
6018
Last updated: <b><%= fmt_date(new Date()) %></b>.<br/>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<span class="argument-link" field="arguments" key="x-expires" type="number">Auto expire</span> <span class="help" id="queue-expires"></span> |
2+
<span class="argument-link" field="arguments" key="x-message-ttl" type="number">Message TTL</span> <span class="help" id="queue-message-ttl"></span> |
3+
<span class="argument-link" field="arguments" key="x-overflow" type="string">Overflow behaviour</span> <span class="help" id="queue-overflow"></span><br/>
4+
<span class="argument-link" field="arguments" key="x-single-active-consumer" type="boolean">Single active consumer</span> <span class="help" id="queue-single-active-consumer"></span> |
5+
<span class="argument-link" field="arguments" key="x-dead-letter-exchange" type="string">Dead letter exchange</span> <span class="help" id="queue-dead-letter-exchange"></span> |
6+
<span class="argument-link" field="arguments" key="x-dead-letter-routing-key" type="string">Dead letter routing key</span> <span class="help" id="queue-dead-letter-routing-key"></span><br/>
7+
<span class="argument-link" field="arguments" key="x-max-length" type="number">Max length</span> <span class="help" id="queue-max-length"></span> |
8+
<span class="argument-link" field="arguments" key="x-max-length-bytes" type="number">Max length bytes</span> <span class="help" id="queue-max-length-bytes"></span>
9+
| <span class="argument-link" field="arguments" key="x-max-priority" type="number">Maximum priority</span> <span class="help" id="queue-max-priority"></span>
10+
| <span class="argument-link" field="arguments" key="x-queue-leader-locator" type="string">Leader locator</span><span class="help" id="queue-leader-locator"></span>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<tr>
2+
<th>Node</th>
3+
<td><%= fmt_node(queue.node) %></td>
4+
</tr>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<tr>
2+
<td>Queues [Classic]</td>
3+
<td>
4+
<span class="argument-link" field="definitionop" key="expires" type="number">Auto expire</span> |
5+
<span class="argument-link" field="definitionop" key="max-length" type="number">Max length</span> |
6+
<span class="argument-link" field="definitionop" key="max-length-bytes" type="number">Max length bytes</span> |
7+
<span class="argument-link" field="definitionop" key="message-ttl" type="number">Message TTL</span> |
8+
<span class="help" id="queue-message-ttl"></span> |
9+
<span class="argument-link" field="definitionop" key="overflow" type="string">Length limit overflow behaviour</span> <span class="help" id="queue-overflow"></span> </br>
10+
</td>
11+
</tr>

0 commit comments

Comments
 (0)