From de17a77df491284230b6e5accbe343717955a62a Mon Sep 17 00:00:00 2001
From: Iliia Khaprov
Date: Fri, 7 Feb 2025 10:23:46 +0100
Subject: [PATCH] Queues with plugins - Enable adding queues with plugins,
Management UI
---
.../rabbitmq_management/priv/www/js/global.js | 243 +++++++++++++++++-
deps/rabbitmq_management/priv/www/js/main.js | 7 +-
.../priv/www/js/tmpl/binary.ejs | 58 +----
.../www/js/tmpl/classic-queue-arguments.ejs | 10 +
.../js/tmpl/classic-queue-node-details.ejs | 4 +
...lassic-queue-operator-policy-arguments.ejs | 11 +
.../priv/www/js/tmpl/classic-queue-stats.ejs | 94 +++++++
.../classic-queue-user-policy-arguments.ejs | 0
.../priv/www/js/tmpl/memory.ejs | 69 +----
.../priv/www/js/tmpl/policies.ejs | 68 ++---
.../priv/www/js/tmpl/queue.ejs | 210 +--------------
.../priv/www/js/tmpl/queues.ejs | 53 +---
.../www/js/tmpl/quorum-queue-arguments.ejs | 13 +
.../www/js/tmpl/quorum-queue-node-details.ejs | 21 ++
...quorum-queue-operator-policy-arguments.ejs | 16 ++
.../priv/www/js/tmpl/quorum-queue-stats.ejs | 106 ++++++++
.../quorum-queue-user-policy-arguments.ejs | 9 +
.../www/js/tmpl/stream-queue-arguments.ejs | 6 +
.../www/js/tmpl/stream-queue-node-details.ejs | 21 ++
...stream-queue-operator-policy-arguments.ejs | 6 +
.../priv/www/js/tmpl/stream-queue-stats.ejs | 56 ++++
.../stream-queue-user-policy-arguments.ejs | 0
22 files changed, 662 insertions(+), 419 deletions(-)
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-node-details.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-operator-policy-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-stats.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-user-policy-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-node-details.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-operator-policy-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-stats.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-user-policy-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-node-details.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-operator-policy-arguments.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-stats.ejs
create mode 100644 deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-user-policy-arguments.ejs
diff --git a/deps/rabbitmq_management/priv/www/js/global.js b/deps/rabbitmq_management/priv/www/js/global.js
index 406e5dc7b8..31fc8a1b5f 100644
--- a/deps/rabbitmq_management/priv/www/js/global.js
+++ b/deps/rabbitmq_management/priv/www/js/global.js
@@ -223,7 +223,7 @@ var HELP = {
'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. (Sets the "x-dead-letter-routing-key " argument.)',
'queue-dead-letter-strategy':
- 'Valid values are at-most-once or at-least-once. It defaults to at-most-once. This setting is understood only by quorum queues. If at-least-once is set, Overflow behaviour must be set to reject-publish. Otherwise, dead letter strategy will fall back to at-most-once.',
+ 'Valid values are at-most-once or at-least-once. It defaults to at-most-once. If at-least-once is set, Overflow behaviour must be set to reject-publish. Otherwise, dead letter strategy will fall back to at-most-once.',
'queue-single-active-consumer':
'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. (Sets the "x-single-active-consumer " argument.)',
@@ -235,7 +235,10 @@ var HELP = {
'Sets the data retention for stream queues in time units (Y=Years, M=Months, D=Days, h=hours, m=minutes, s=seconds). E.g. "1h" configures the stream to only keep the last 1 hour of received messages.(Sets the x-max-age argument.)',
'queue-overflow':
- 'Sets the queue overflow behaviour . This determines what happens to messages when the maximum length of a queue is reached. Valid values are drop-head, reject-publish or reject-publish-dlx. The quorum queue type only supports drop-head and reject-publish.',
+ 'Sets the queue overflow behaviour . This determines what happens to messages when the maximum length of a queue is reached. Valid values are drop-head, reject-publish or reject-publish-dlx',
+
+ 'quorum-queue-overflow':
+ 'Sets the queue overflow behaviour . This determines what happens to messages when the maximum length of a queue is reached. Valid values for quorum queues are drop-head and reject-publish.',
'queue-master-locator':
'Deprecated: please use `queue-leader-locator` instead. Controls which node the queue will be running on. ',
@@ -887,3 +890,239 @@ var chart_data = {};
var last_page_out_of_range_error = 0;
var oauth;
+
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// Queue types //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+/// this queue types are very well known to the server, at the very least
+/// this collection must be validated in terms of matching server queue
+/// types registry. I hope I will have time for this.
+
+/// this one defaults to classic, How can a queue be without type?
+var QUEUE_TYPE = function (queue) {
+ if (queue["arguments"]) {
+ if (queue["arguments"]["x-queue-type"]) {
+ return QUEUE_TYPE[queue["arguments"]["x-queue-type"]];
+ } else {
+ /// I observed that streams do not have
+ /// (at least always) x-queue-type
+ /// but all queues seems to be having
+ /// type field.
+ /// curiosuly is_[type] functions in main.js
+ /// rely on x-queue-type. is_stream might be
+ /// broken here.
+ if (queue.hasOwnProperty("type")) {
+ return QUEUE_TYPE[queue.type];
+ }
+ else {
+ return QUEUE_TYPE["classic"];
+ }
+ }
+ } else {
+ return QUEUE_TYPE["classic"];
+ }
+}
+// TODO: while this allows for custom queues
+// the proper way is to follow single source of truth
+// and generate most of this on the server from queue type metadata
+// including replacing tmpl's with data-driven generators
+// For example server knows policy_apply_to for each queue
+// and it knows what extra agruments each queue type accepts.
+// So for the latter case we dont' need a template that lists
+// queue args. We need iterator over server-supplied object.
+QUEUE_TYPE["default"] = {
+ label: "Default",
+ params: {},
+ policy_apply_to: "classic_queue",
+ actions: {
+ get_message: true,
+ purge: true
+ },
+ tmpl: {
+ "arguments" : "classic-queue-arguments",
+ // TODO: this must be generated from js objects of course.
+ // and then those objects must be rendered by the server
+ "user_policy_arguments": "classic-queue-user-policy-arguments",
+ "operator_policy_arguments": "classic-queue-operator-policy-arguments",
+ "list" : "classic-queue-list",
+ "stats" : "classic-queue-stats",
+ "node_details" : "classic-queue-node-details"
+ }
+};
+
+QUEUE_TYPE["classic"] = {
+ label: "Classic",
+ params: {},
+ policy_apply_to: "classic_queue",
+ actions: {
+ get_message: true,
+ purge: true
+ },
+ tmpl: {
+ "arguments" : "classic-queue-arguments",
+ "user_policy_arguments": "classic-queue-user-policy-arguments",
+ "operator_policy_arguments": "classic-queue-operator-policy-arguments",
+ "list" : "classic-queue-list",
+ "stats" : "classic-queue-stats",
+ "node_details" : "classic-queue-node-details"
+ }
+};
+
+QUEUE_TYPE["quorum"] = {
+ label: "Quorum",
+ params: {
+ 'durable': true,
+ 'auto_delete': false
+ },
+ policy_apply_to: "quorum_queues",
+ actions: {
+ get_message: true,
+ purge: true
+ },
+ tmpl: {
+ "arguments" : "quorum-queue-arguments",
+ "user_policy_arguments": "quorum-queue-user-policy-arguments",
+ "operator_policy_arguments": "quorum-queue-operator-policy-arguments",
+ "list" : "quorum-queue-list",
+ "stats": "quorum-queue-stats",
+ "node_details" : "quorum-queue-node-details"
+ }
+};
+
+QUEUE_TYPE["stream"] = {
+ label: "Stream",
+ params: {
+ 'durable': true,
+ 'auto_delete': false
+ },
+ policy_apply_to: "streams",
+ actions: {
+ get_message: false,
+ purge: false
+ },
+ tmpl: {
+ "arguments" : "stream-queue-arguments",
+ "user_policy_arguments": "quorum-queue-user-policy-arguments",
+ "operator_policy_arguments": "stream-queue-operator-policy-arguments",
+ "list" : "stream-queue-list",
+ "stats" : "stream-queue-stats",
+ "node_details" : "stream-queue-node-details"
+ }
+};
+
+// here I'll shortcut for now and let it be like that
+// other queue types can inject themlves where they want.
+// since the 'sections' object will likely keep key insertion
+// order custom keys for queue type will be coming last.
+
+// maybe add helper functions?
+var MEMORY_STATISTICS = {
+ sections: {'queue_procs' : ['classic', 'Classic queues'],
+ 'quorum_queue_procs' : ['quorum', 'Quorum queues'],
+ 'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
+ 'stream_queue_procs' : ['stream', 'Stream queues'],
+ 'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
+ 'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
+ 'binary' : ['binary', 'Binaries'],
+ 'connection_readers' : ['conn', 'Connection readers'],
+ 'connection_writers' : ['conn', 'Connection writers'],
+ 'connection_channels' : ['conn', 'Connection channels'],
+ 'connection_other' : ['conn', 'Connections (other)'],
+ 'mnesia' : ['table', 'Mnesia'],
+ 'msg_index' : ['table', 'Message store index'],
+ 'mgmt_db' : ['table', 'Management database'],
+ 'quorum_ets' : ['table', 'Quorum queue ETS tables'],
+ 'other_ets' : ['table', 'Other ETS tables'],
+ 'plugins' : ['proc', 'Plugins'],
+ 'other_proc' : ['proc', 'Other process memory'],
+ 'code' : ['system', 'Code'],
+ 'atom' : ['system', 'Atoms'],
+ 'other_system' : ['system', 'Other system'],
+ 'allocated_unused' : ['unused', 'Allocated unused'],
+ 'reserved_unallocated': ['unused', 'Unallocated reserved by the OS']},
+ keys: [[{name: 'Classic Queues', colour: 'classic',
+ keys: [['queue_procs', 'queues']]},
+ {name: 'Quorum Queues', colour: 'quorum',
+ keys: [['quorum_queue_procs','quorum'],
+ ['quorum_queue_dlx_procs', 'dead letter workers']]},
+ {name: 'Streams', colour: 'stream',
+ keys: [['stream_queue_procs', 'stream'],
+ ['stream_queue_replica_reader_procs', 'stream replica reader'],
+ ['stream_queue_coordinator_procs', 'stream coordinator']]},
+ {name: 'Binaries', colour: 'binary',
+ keys: [['binary', '']]}],
+
+ [{name: 'Connections', colour: 'conn',
+ keys: [['connection_readers', 'readers'],
+ ['connection_writers', 'writers'],
+ ['connection_channels', 'channels'],
+ ['connection_other', 'other']]}],
+
+ [{name: 'Tables', colour: 'table',
+ keys: [['mnesia', 'internal database tables'],
+ ['msg_index', 'message store index'],
+ ['mgmt_db', 'management database'],
+ ['quorum_ets', 'quorum queue tables'],
+ ['other_ets', 'other']]}],
+
+ [{name: 'Processes', colour: 'proc',
+ keys: [['plugins', 'plugins'],
+ ['metadata_store', 'metadata store'],
+ ['other_proc', 'other']]},
+ {name: 'System', colour: 'system',
+ keys: [['code', 'code'],
+ ['atom', 'atoms'],
+ ['other_system', 'other']
+ ]}],
+
+ [{name: 'Preallocated memory', colour: 'unused',
+ keys: [['allocated_unused', 'preallocated by runtime, unused'],
+ ['reserved_unallocated', 'unallocated, reserved by the OS']]}]]
+}
+
+var BINARY_STATISTICS = {
+ sections: {'queue_procs' : ['classic', 'Classic queues'],
+ 'quorum_queue_procs' : ['quorum', 'Quorum queues'],
+ 'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
+ 'stream_queue_procs' : ['stream', 'Stream queues'],
+ 'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
+ 'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
+ 'connection_readers' : ['conn', 'Connection readers'],
+ 'connection_writers' : ['conn', 'Connection writers'],
+ 'connection_channels' : ['conn', 'Connection channels'],
+ 'connection_other' : ['conn', 'Connections (other)'],
+ 'msg_index' : ['table', 'Message store index'],
+ 'mgmt_db' : ['table', 'Management database'],
+ 'plugins' : ['proc', 'Plugins'],
+ 'metadata_store' : ['metadata_store', 'Metadata store'],
+ 'other' : ['system', 'Other binary references']},
+ key: [[{name: 'Classic Queues', colour: 'classic',
+ keys: [['queue_procs', 'queues']]},
+ {name: 'Quorum Queues', colour: 'quorum',
+ keys: [['quorum_queue_procs', 'quorum'],
+ ['quorum_queue_dlx_procs', 'dead letter workers']]},
+ {name: 'Streams', colour: 'stream',
+ keys: [['stream_queue_procs', 'stream'],
+ ['stream_queue_replica_reader_procs', 'stream replica reader'],
+ ['stream_queue_coordinator_procs', 'stream coordinator']]}],
+
+ [{name: 'Connections', colour: 'conn',
+ keys: [['connection_readers', 'readers'],
+ ['connection_writers', 'writers'],
+ ['connection_channels', 'channels'],
+ ['connection_other', 'other']]}],
+
+ [{name: 'Tables', colour: 'table',
+ keys: [['msg_index', 'message store index'],
+ ['mgmt_db', 'management database']]}],
+
+ [{name: 'Processes', colour: 'proc',
+ keys: [['plugins', 'plugins'],
+ ['metadata_store', 'metadata store']]},
+ {name: 'System', colour: 'system',
+ keys: [['other', 'other']]}]]
+};
diff --git a/deps/rabbitmq_management/priv/www/js/main.js b/deps/rabbitmq_management/priv/www/js/main.js
index 10dc66bd26..bfa363f57b 100644
--- a/deps/rabbitmq_management/priv/www/js/main.js
+++ b/deps/rabbitmq_management/priv/www/js/main.js
@@ -1578,11 +1578,8 @@ function collapse_multifields(params0) {
if (queue_type != 'default') {
params['arguments']['x-queue-type'] = queue_type;
}
- if (queue_type == 'quorum' ||
- queue_type == 'stream') {
- params['durable'] = true;
- params['auto_delete'] = false;
- }
+
+ params = Object.assign(params, QUEUE_TYPE[queue_type].params)
}
return params;
}
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/binary.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/binary.ejs
index 19a0f7ea9a..815ee3c960 100644
--- a/deps/rabbitmq_management/priv/www/js/tmpl/binary.ejs
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/binary.ejs
@@ -5,56 +5,14 @@
Binary statistics not available.
<% } else { %>
-<%
- var sections = {'queue_procs' : ['classic', 'Classic queues'],
- 'quorum_queue_procs' : ['quorum', 'Quorum queues'],
- 'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
- 'stream_queue_procs' : ['stream', 'Stream queues'],
- 'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
- 'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
- 'connection_readers' : ['conn', 'Connection readers'],
- 'connection_writers' : ['conn', 'Connection writers'],
- 'connection_channels' : ['conn', 'Connection channels'],
- 'connection_other' : ['conn', 'Connections (other)'],
- 'msg_index' : ['table', 'Message store index'],
- 'mgmt_db' : ['table', 'Management database'],
- 'plugins' : ['proc', 'Plugins'],
- 'metadata_store' : ['metadata_store', 'Metadata store'],
- 'other' : ['system', 'Other binary references']};
- var total_out = [];
-%>
-<%= format('memory-bar', {sections: sections, memory: binary, total_out: total_out}) %>
-
-
-<%
-var key = [[{name: 'Classic Queues', colour: 'classic',
- keys: [['queue_procs', 'queues']]},
- {name: 'Quorum Queues', colour: 'quorum',
- keys: [['quorum_queue_procs', 'quorum'],
- ['quorum_queue_dlx_procs', 'dead letter workers']]},
- {name: 'Streams', colour: 'stream',
- keys: [['stream_queue_procs', 'stream'],
- ['stream_queue_replica_reader_procs', 'stream replica reader'],
- ['stream_queue_coordinator_procs', 'stream coordinator']]}],
-
- [{name: 'Connections', colour: 'conn',
- keys: [['connection_readers', 'readers'],
- ['connection_writers', 'writers'],
- ['connection_channels', 'channels'],
- ['connection_other', 'other']]}],
-
- [{name: 'Tables', colour: 'table',
- keys: [['msg_index', 'message store index'],
- ['mgmt_db', 'management database']]}],
-
- [{name: 'Processes', colour: 'proc',
- keys: [['plugins', 'plugins'],
- ['metadata_store', 'metadata store']]},
- {name: 'System', colour: 'system',
- keys: [['other', 'other']]}]];
-%>
-<%= format('memory-table', {key: key, memory: binary}) %>
-
+ <%
+ var total_out = [];
+ %>
+ <%= format('memory-bar', {sections: BINARY_STATISTICS.sections, memory: binary, total_out: total_out}) %>
+
+
+ <%= format('memory-table', {key: BINARY_STATISTICS. key, memory: binary}) %>
+
Last updated:
<%= fmt_date(new Date()) %> .
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-arguments.ejs
new file mode 100644
index 0000000000..ff3d60c32a
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-arguments.ejs
@@ -0,0 +1,10 @@
+
Auto expire |
+
Message TTL |
+
Overflow behaviour
+
Single active consumer |
+
Dead letter exchange |
+
Dead letter routing key
+
Max length |
+
Max length bytes
+ |
Maximum priority
+ |
Leader locator
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-node-details.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-node-details.ejs
new file mode 100644
index 0000000000..eaefb2fd4b
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-node-details.ejs
@@ -0,0 +1,4 @@
+
+ Node
+ <%= fmt_node(queue.node) %>
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-operator-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-operator-policy-arguments.ejs
new file mode 100644
index 0000000000..116131fee3
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-operator-policy-arguments.ejs
@@ -0,0 +1,11 @@
+
+ Queues [Classic]
+
+ Auto expire |
+ Max length |
+ Max length bytes |
+ Message TTL |
+ |
+ Length limit overflow behaviour
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-stats.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-stats.ejs
new file mode 100644
index 0000000000..d779d6cca7
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-stats.ejs
@@ -0,0 +1,94 @@
+
+
+ State
+ <%= fmt_object_state(queue) %>
+
+ <% if(queue.consumers) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumers) %>
+
+ <% } else if(queue.hasOwnProperty('consumer_details')) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumer_details.length) %>
+
+ <% } %>
+
+ Consumer capacity
+ <%= fmt_percent(queue.consumer_capacity) %>
+
+ <% if(queue.hasOwnProperty('publishers')) { %>
+
+ Publishers
+ <%= fmt_string(queue.publishers) %>
+
+ <% } %>
+
+
+
+
+
+ Total
+ Ready
+ Unacked
+ In memory
+ Persistent
+ Transient, Paged Out
+
+
+
+ Messages
+
+
+
+ <%= fmt_num_thousands(queue.messages) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ready) %>
+
+
+ <%= fmt_num_thousands(queue.messages_unacknowledged) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ram) %>
+
+
+ <%= fmt_num_thousands(queue.messages_persistent) %>
+
+
+ <%= fmt_num_thousands(queue.messages_paged_out) %>
+
+
+
+
+ Message body bytes
+
+
+
+ <%= fmt_bytes(queue.message_bytes) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_ready) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_unacknowledged) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_ram) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_persistent) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_paged_out) %>
+
+
+
+
+ Process memory
+
+
+ <%= fmt_bytes(queue.memory) %>
+
+
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-user-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/classic-queue-user-policy-arguments.ejs
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/memory.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/memory.ejs
index 03c4423299..bbded7589e 100644
--- a/deps/rabbitmq_management/priv/www/js/tmpl/memory.ejs
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/memory.ejs
@@ -5,75 +5,10 @@
Memory statistics not available.
<% } else { %>
-<%
- var sections = {'queue_procs' : ['classic', 'Classic queues'],
- 'quorum_queue_procs' : ['quorum', 'Quorum queues'],
- 'quorum_queue_dlx_procs' : ['quorum', 'Dead letter workers'],
- 'stream_queue_procs' : ['stream', 'Stream queues'],
- 'stream_queue_replica_reader_procs' : ['stream', 'Stream queues (replica reader)'],
- 'stream_queue_coordinator_procs' : ['stream', 'Stream queues (coordinator)'],
- 'binary' : ['binary', 'Binaries'],
- 'connection_readers' : ['conn', 'Connection readers'],
- 'connection_writers' : ['conn', 'Connection writers'],
- 'connection_channels' : ['conn', 'Connection channels'],
- 'connection_other' : ['conn', 'Connections (other)'],
- 'mnesia' : ['table', 'Mnesia'],
- 'msg_index' : ['table', 'Message store index'],
- 'mgmt_db' : ['table', 'Management database'],
- 'quorum_ets' : ['table', 'Quorum queue ETS tables'],
- 'other_ets' : ['table', 'Other ETS tables'],
- 'plugins' : ['proc', 'Plugins'],
- 'other_proc' : ['proc', 'Other process memory'],
- 'code' : ['system', 'Code'],
- 'atom' : ['system', 'Atoms'],
- 'other_system' : ['system', 'Other system'],
- 'allocated_unused' : ['unused', 'Allocated unused'],
- 'reserved_unallocated': ['unused', 'Unallocated reserved by the OS']};
-%>
-<%= format('memory-bar', {sections: sections, memory: memory, total_out: []}) %>
+<%= format('memory-bar', {sections: MEMORY_STATISTICS.sections, memory: memory, total_out: []}) %>
-<%
-var key = [[{name: 'Classic Queues', colour: 'classic',
- keys: [['queue_procs', 'queues']]},
- {name: 'Quorum Queues', colour: 'quorum',
- keys: [['quorum_queue_procs','quorum'],
- ['quorum_queue_dlx_procs', 'dead letter workers']]},
- {name: 'Streams', colour: 'stream',
- keys: [['stream_queue_procs', 'stream'],
- ['stream_queue_replica_reader_procs', 'stream replica reader'],
- ['stream_queue_coordinator_procs', 'stream coordinator']]},
- {name: 'Binaries', colour: 'binary',
- keys: [['binary', '']]}],
-
- [{name: 'Connections', colour: 'conn',
- keys: [['connection_readers', 'readers'],
- ['connection_writers', 'writers'],
- ['connection_channels', 'channels'],
- ['connection_other', 'other']]}],
-
- [{name: 'Tables', colour: 'table',
- keys: [['mnesia', 'internal database tables'],
- ['msg_index', 'message store index'],
- ['mgmt_db', 'management database'],
- ['quorum_ets', 'quorum queue tables'],
- ['other_ets', 'other']]}],
-
- [{name: 'Processes', colour: 'proc',
- keys: [['plugins', 'plugins'],
- ['metadata_store', 'metadata store'],
- ['other_proc', 'other']]},
- {name: 'System', colour: 'system',
- keys: [['code', 'code'],
- ['atom', 'atoms'],
- ['other_system', 'other']
- ]}],
-
- [{name: 'Preallocated memory', colour: 'unused',
- keys: [['allocated_unused', 'preallocated by runtime, unused'],
- ['reserved_unallocated', 'unallocated, reserved by the OS']]}]];
-%>
-<%= format('memory-table', {key: key, memory: memory}) %>
+<%= format('memory-table', {key: MEMORY_STATISTICS.keys, memory: memory}) %>
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/policies.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/policies.ejs
index 54ee481896..67dd859498 100644
--- a/deps/rabbitmq_management/priv/www/js/tmpl/policies.ejs
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/policies.ejs
@@ -83,9 +83,11 @@
Exchanges and queues
Exchanges
Queues
-
Classic Queues
-
Quorum Queues
-
Streams
+ <% for (const [typename, type_config] of Object.entries(QUEUE_TYPE)) { %>
+ <% if (typename != "default") { %>
+
<%= type_config.label %> Queues
+ <% } %>
+ <% } %>
@@ -111,15 +113,11 @@
Consumer Timeout |
Leader locator
-
- Queues [Quorum]
-
- Delivery limit
- |
- Dead letter strategy
- |
-
-
+ <% for (const [typename, type_config] of Object.entries(QUEUE_TYPE)) { %>
+ <% if (typename != "default") { %>
+ <%= format(type_config.tmpl.user_policy_arguments, {}) %>
+ <% } %>
+ <% } %>
Streams
@@ -246,9 +244,11 @@
Queues
- Classic Queues
- Quorum Queues
- Streams
+ <% for (const [typename, type_config] of Object.entries(QUEUE_TYPE)) { %>
+ <% if (typename != "default") { %>
+ <%= type_config.label %> Queues
+ <% } %>
+ <% } %>
@@ -261,39 +261,11 @@
-
- Queues [Classic]
-
- Auto expire |
- Max length |
- Max length bytes |
- Message TTL |
- |
- Length limit overflow behaviour
-
-
-
- Queues [Quorum]
-
- Delivery limit
- |
- Auto expire |
- Max in-memory bytes |
- Max in-memory length
- Max length |
- Max length bytes |
- Message TTL
- |
- Target group size |
- Length limit overflow behaviour
-
-
-
- Queues [Streams]
-
- Max length bytes
-
-
+ <% for (const [typename, type_config] of Object.entries(QUEUE_TYPE)) { %>
+ <% if (typename != "default") { %>
+ <%= format(type_config.tmpl.operator_policy_arguments, {}) %>
+ <% } %>
+ <% } %>
*
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs
index cf37516d6d..a8ddcd81e6 100644
--- a/deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/queue.ejs
@@ -37,212 +37,12 @@
<% } %>
<% if (nodes_interesting) { %>
-
- <% if (is_quorum(queue) || is_stream(queue)) { %>
- Leader
- <% } else { %>
- Node
- <% } %>
- <% if (queue.leader) { %>
- <%= fmt_node(queue.leader) %>
- <% } else { %>
- <%= fmt_node(queue.node) %>
- <% } %>
-
- <% if (is_quorum(queue) || is_stream(queue)) { %>
-
- Online
-
- <%
- for (var i in queue.online) {
- %>
- <%= fmt_node(queue.online[i]) %>
-
- <% } %>
-
-
-
Members
-
- <%
- for (var i in queue.members) {
- %>
- <%= fmt_node(queue.members[i]) %>
-
- <% } %>
-
-
- <% } %>
+ <%= format(QUEUE_TYPE(queue).tmpl.node_details, {queue: queue}) %>
<% } %>
-<% if(!disable_stats) { %>
-
-
- State
- <%= fmt_object_state(queue) %>
-
- <% if(queue.consumers) { %>
-
- Consumers
- <%= fmt_string(queue.consumers) %>
-
- <% } else if(queue.hasOwnProperty('consumer_details')) { %>
-
- Consumers
- <%= fmt_string(queue.consumer_details.length) %>
-
- <% } %>
- <% if (is_classic(queue)) { %>
-
- Consumer capacity
- <%= fmt_percent(queue.consumer_capacity) %>
-
- <% } %>
- <% if(queue.hasOwnProperty('publishers')) { %>
-
- Publishers
- <%= fmt_string(queue.publishers) %>
-
- <% } %>
- <% if (is_quorum(queue)) { %>
-
- Open files
- <%= fmt_table_short(queue.open_files) %>
-
- <% if (queue.hasOwnProperty('delivery_limit')) { %>
-
- Delivery limit
- <%= fmt_string(queue.delivery_limit) %>
-
- <% } %>
- <% } %>
- <% if (is_stream(queue)) { %>
-
- Readers
- <%= fmt_table_short(queue.readers) %>
-
-
- Segments
- <%= fmt_string(queue.segments) %>
-
- <% } %>
-
-
-
-
-
- Total
- <% if (!is_stream(queue)) { %>
- Ready
- Unacked
- <% } %>
- <% if (is_quorum(queue)) { %>
- High priority
- Normal priority
- Returned
- Dead-lettered
-
-
- <% } %>
- <% if (is_classic(queue)) { %>
- In memory
- Persistent
- Transient
- <% } %>
-
-
-
- Messages
- <% if (is_stream(queue)) { %>
-
- <% } else { %>
-
- <% } %>
-
-
- <%= fmt_num_thousands(queue.messages) %>
-
- <% if (!is_stream(queue)) { %>
-
- <%= fmt_num_thousands(queue.messages_ready) %>
-
-
- <%= fmt_num_thousands(queue.messages_unacknowledged) %>
-
- <% } %>
- <% if (is_quorum(queue)) { %>
-
- <%= fmt_num_thousands(queue.messages_ready_high) %>
-
-
- <%= fmt_num_thousands(queue.messages_ready_normal) %>
-
-
- <%= fmt_num_thousands(queue.messages_ready_returned) %>
-
-
- <%= fmt_num_thousands(queue.messages_dlx) %>
-
- <% } %>
- <% if (is_classic(queue)) { %>
-
- <%= fmt_num_thousands(queue.messages_ram) %>
-
-
- <%= fmt_num_thousands(queue.messages_persistent) %>
-
-
- <%= fmt_num_thousands(queue.messages_paged_out) %>
-
- <% } %>
-
-
- <% if (is_classic(queue) || is_quorum(queue)) { %>
-
- Message body bytes
-
-
-
- <%= fmt_bytes(queue.message_bytes) %>
-
-
- <%= fmt_bytes(queue.message_bytes_ready) %>
-
-
- <%= fmt_bytes(queue.message_bytes_unacknowledged) %>
-
- <% } %>
- <% if (is_quorum(queue)) { %>
-
-
-
-
-
-
-
- <%= fmt_bytes(queue.message_bytes_dlx) %>
-
- <% } %>
- <% if (is_classic(queue)) { %>
-
- <%= fmt_bytes(queue.message_bytes_ram) %>
-
-
- <%= fmt_bytes(queue.message_bytes_persistent) %>
-
-
- <%= fmt_bytes(queue.message_bytes_paged_out) %>
-
- <% } %>
-
-
-
- Process memory
-
-
- <%= fmt_bytes(queue.memory) %>
-
-
+ <% if(!disable_stats) { %>
+ <%= format(QUEUE_TYPE(queue).tmpl.stats, {queue: queue}) %>
<% } %>
@@ -300,7 +100,7 @@
<%= format('publish', {'mode': 'queue', 'queue': queue}) %>
-<% if (!is_stream(queue)) { %>
+<% if (QUEUE_TYPE(queue).actions.get_message) { %>
Get messages
@@ -409,7 +209,7 @@
<% } %>
-<% if (!is_stream(queue)) { %>
+<% if (QUEUE_TYPE(queue).actions.purge) { %>
Purge
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/queues.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/queues.ejs
index 8d2201295f..d1e9d8bca3 100644
--- a/deps/rabbitmq_management/priv/www/js/tmpl/queues.ejs
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/queues.ejs
@@ -245,22 +245,16 @@
Type:
- Default for virtual host
- <% if (queue_type == "classic") { %>
- Classic
- <% } else { %>
- Classic
- <% } %>
- <% if (queue_type == "quorum") { %>
- Quorum
- <% } else { %>
- Quorum
- <% } %>
- <% if (queue_type == "stream") { %>
- Stream
- <% } else { %>
- Stream
- <% } %>
+ Default for virtual host
+ <% for (const [typename, type_config] of Object.entries(QUEUE_TYPE)) { %>
+ <% if (typename != "default") { %>
+ <% if (queue_type == typename) { %>
+ <%= type_config["label"]%>
+ <% } else { %>
+ <%= type_config["label"]%>
+ <% } %>
+ <% } %>
+ <% } %>
@@ -313,32 +307,7 @@
Add
- <% if (queue_type != "stream") { %>
- Auto expire |
- Message TTL |
- Overflow behaviour
- Single active consumer |
- Dead letter exchange |
- Dead letter routing key
- Max length |
- <% } %>
- Max length bytes
- <% if (queue_type == "classic") { %>
- | Maximum priority
- <% } %>
- <% if (queue_type == "quorum") { %>
- | Delivery limit
- | Initial cluster size
- Target cluster size
- | Dead letter strategy
- <% } %>
- <% if (queue_type == "stream") { %>
- | Max time retention
- | Max segment size in bytes
- Filter size (per chunk) in bytes
- | Initial cluster size
- <% } %>
- | Leader locator
+ <%= format(QUEUE_TYPE[queue_type].tmpl['arguments'], {}) %>
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-arguments.ejs
new file mode 100644
index 0000000000..d1a7282e22
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-arguments.ejs
@@ -0,0 +1,13 @@
+
Auto expire |
+
Message TTL |
+
Overflow behaviour
+
Single active consumer |
+
Dead letter exchange |
+
Dead letter routing key
+
Max length |
+
Max length bytes
+|
Delivery limit
+|
Initial cluster size
+
Target cluster size
+ |
Dead letter strategy
+|
Leader locator
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-node-details.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-node-details.ejs
new file mode 100644
index 0000000000..a25e6d7a3a
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-node-details.ejs
@@ -0,0 +1,21 @@
+
+ Leader
+ <%= fmt_node(queue.leader) %>
+
+
+ Online
+
+ <% for (var i in queue.online) { %>
+ <%= fmt_node(queue.online[i]) %>
+
+ <% } %>
+
+
+
Members
+
+ <% for (var i in queue.members) { %>
+ <%= fmt_node(queue.members[i]) %>
+
+ <% } %>
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-operator-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-operator-policy-arguments.ejs
new file mode 100644
index 0000000000..4e13f8ea94
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-operator-policy-arguments.ejs
@@ -0,0 +1,16 @@
+
+ Queues [Quorum]
+
+ Delivery limit
+ |
+ Auto expire |
+ Max in-memory bytes |
+ Max in-memory length
+ Max length |
+ Max length bytes |
+ Message TTL
+ |
+ Target group size |
+ Length limit overflow behaviour
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-stats.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-stats.ejs
new file mode 100644
index 0000000000..15191860c3
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-stats.ejs
@@ -0,0 +1,106 @@
+
+
+ State
+ <%= fmt_object_state(queue) %>
+
+ <% if(queue.consumers) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumers) %>
+
+ <% } else if(queue.hasOwnProperty('consumer_details')) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumer_details.length) %>
+
+ <% } %>
+ <% if(queue.hasOwnProperty('publishers')) { %>
+
+ Publishers
+ <%= fmt_string(queue.publishers) %>
+
+ <% } %>
+
+ Open files
+ <%= fmt_table_short(queue.open_files) %>
+
+ <% if (queue.hasOwnProperty('delivery_limit')) { %>
+
+ Delivery limit
+ <%= fmt_string(queue.delivery_limit) %>
+
+ <% } %>
+
+
+
+
+
+ Total
+ Ready
+ Unacked
+ High priority
+ Normal priority
+ Returned
+ Dead-lettered
+
+
+
+
+
+ Messages
+
+
+
+ <%= fmt_num_thousands(queue.messages) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ready) %>
+
+
+ <%= fmt_num_thousands(queue.messages_unacknowledged) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ready_high) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ready_normal) %>
+
+
+ <%= fmt_num_thousands(queue.messages_ready_returned) %>
+
+
+ <%= fmt_num_thousands(queue.messages_dlx) %>
+
+
+
+
+ Message body bytes
+
+
+
+ <%= fmt_bytes(queue.message_bytes) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_ready) %>
+
+
+ <%= fmt_bytes(queue.message_bytes_unacknowledged) %>
+
+
+
+
+
+
+
+
+ <%= fmt_bytes(queue.message_bytes_dlx) %>
+
+
+
+
+ Process memory
+
+
+ <%= fmt_bytes(queue.memory) %>
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-user-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-user-policy-arguments.ejs
new file mode 100644
index 0000000000..2a29a627ed
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/quorum-queue-user-policy-arguments.ejs
@@ -0,0 +1,9 @@
+
+ Queues [Quorum]
+
+ Delivery limit
+ |
+ Dead letter strategy
+ |
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-arguments.ejs
new file mode 100644
index 0000000000..1bc197b328
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-arguments.ejs
@@ -0,0 +1,6 @@
+
Max length bytes
+|
Max time retention
+|
Max segment size in bytes
+
Filter size (per chunk) in bytes
+|
Initial cluster size
+|
Leader locator
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-node-details.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-node-details.ejs
new file mode 100644
index 0000000000..a25e6d7a3a
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-node-details.ejs
@@ -0,0 +1,21 @@
+
+ Leader
+ <%= fmt_node(queue.leader) %>
+
+
+ Online
+
+ <% for (var i in queue.online) { %>
+ <%= fmt_node(queue.online[i]) %>
+
+ <% } %>
+
+
+
Members
+
+ <% for (var i in queue.members) { %>
+ <%= fmt_node(queue.members[i]) %>
+
+ <% } %>
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-operator-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-operator-policy-arguments.ejs
new file mode 100644
index 0000000000..01039ed7b1
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-operator-policy-arguments.ejs
@@ -0,0 +1,6 @@
+
+ Queues [Streams]
+
+ Max length bytes
+
+
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-stats.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-stats.ejs
new file mode 100644
index 0000000000..aca685bc30
--- /dev/null
+++ b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-stats.ejs
@@ -0,0 +1,56 @@
+
+
+ State
+ <%= fmt_object_state(queue) %>
+
+ <% if(queue.consumers) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumers) %>
+
+ <% } else if(queue.hasOwnProperty('consumer_details')) { %>
+
+ Consumers
+ <%= fmt_string(queue.consumer_details.length) %>
+
+ <% } %>
+ <% if(queue.hasOwnProperty('publishers')) { %>
+
+ Publishers
+ <%= fmt_string(queue.publishers) %>
+
+ <% } %>
+
+ Readers
+ <%= fmt_table_short(queue.readers) %>
+
+
+ Segments
+ <%= fmt_string(queue.segments) %>
+
+
+
+
+
+
+ Total
+
+
+
+ Messages
+
+
+
+ <%= fmt_num_thousands(queue.messages) %>
+
+
+
+
+
+
+ Process memory
+
+
+ <%= fmt_bytes(queue.memory) %>
+
+
\ No newline at end of file
diff --git a/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-user-policy-arguments.ejs b/deps/rabbitmq_management/priv/www/js/tmpl/stream-queue-user-policy-arguments.ejs
new file mode 100644
index 0000000000..e69de29bb2