From 0c651dd17b81f9d4f352142adbdff8ebadc1f0f1 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Mon, 21 Mar 2022 18:23:46 -0400 Subject: [PATCH] ARTEMIS-3720 Exposing global-max-messages on the CLI --- .../activemq/artemis/cli/commands/Create.java | 5 + .../cli/commands/etc/global-max-default.txt | 4 + .../cli/commands/etc/global-max-specified.txt | 9 +- tests/smoke-tests/pom.xml | 3 +- .../pagingGlobalMaxMessages/broker.xml | 184 ------------------ 5 files changed, 18 insertions(+), 187 deletions(-) delete mode 100644 tests/smoke-tests/src/main/resources/servers/pagingGlobalMaxMessages/broker.xml diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index cb0863ca08..ea9e741289 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -287,6 +287,9 @@ public class Create extends InputAbstract { @Option(name = "--global-max-size", description = "Maximum amount of memory which message data may consume (Default: Undefined, half of the system's memory)") private String globalMaxSize; + @Option(name = "--global-max-messages", description = "Maximum number of messages that will be accepted in memory before using address full policy mode.(Default: Undefined)") + private long globalMaxMessages = -1; + @Option(name = "--jdbc", description = "It will activate jdbc") boolean jdbc; @@ -669,6 +672,8 @@ public class Create extends InputAbstract { filters.put("${encoded.role}", role.replaceAll(" ", "\\\\ ")); + filters.put("${global-max-messages}", Long.toString(globalMaxMessages)); + if (globalMaxSize == null || globalMaxSize.trim().equals("")) { filters.put("${global-max-section}", readTextFile(ETC_GLOBAL_MAX_DEFAULT_TXT, filters)); } else { diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-default.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-default.txt index 7b29efe529..49bc773fda 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-default.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-default.txt @@ -4,3 +4,7 @@ You may specify a different value here if you need to customize it to your needs. 100Mb --> + + + ${global-max-messages} diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-specified.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-specified.txt index 4d617b296b..7012496787 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-specified.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/global-max-specified.txt @@ -1,3 +1,8 @@ - + ${global-max-size} + + + ${global-max-messages} diff --git a/tests/smoke-tests/pom.xml b/tests/smoke-tests/pom.xml index 6edcf884ea..d9f1d01b9c 100644 --- a/tests/smoke-tests/pom.xml +++ b/tests/smoke-tests/pom.xml @@ -909,7 +909,6 @@ - ${basedir}/target/classes/servers/pagingGlobalMaxMessages true admin admin @@ -918,6 +917,8 @@ --java-options -Djava.rmi.server.hostname=localhost + --global-max-messages + 1000 diff --git a/tests/smoke-tests/src/main/resources/servers/pagingGlobalMaxMessages/broker.xml b/tests/smoke-tests/src/main/resources/servers/pagingGlobalMaxMessages/broker.xml deleted file mode 100644 index 4a369b4bf0..0000000000 --- a/tests/smoke-tests/src/main/resources/servers/pagingGlobalMaxMessages/broker.xml +++ /dev/null @@ -1,184 +0,0 @@ - - - - - - - - 0.0.0.0 - - true - - - NIO - - ./data/paging - - ./data/bindings - - ./data/journal - - ./data/large-messages - - true - - 2 - - -1 - - 1000 - - - - - - - - - - - - - - - - - - - - - - 5000 - - - 90 - - 1000 - - - - - - - - - - - - tcp://0.0.0.0:61616?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=CORE,AMQP,STOMP,HORNETQ,MQTT,OPENWIRE;useEpoll=true;useKQueue;amqpCredits=1000;amqpLowCredits=300;actorThresholdBytes=10000 - - - tcp://0.0.0.0:5672?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=AMQP;useEpoll=true;useKQueue=true;amqpCredits=1000;amqpLowCredits=300 - - - tcp://0.0.0.0:61613?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=STOMP;useEpoll=true;useKQueue=true - - - tcp://0.0.0.0:5445?protocols=HORNETQ,STOMP;useEpoll=true;useKQueue=true - - - tcp://0.0.0.0:1883?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576;protocols=MQTT;useEpoll=true;useKQueue=true - - - - - - - - - - - - - - - - - - - - - - - - DLQ - ExpiryQueue - 0 - - -1 - 10 - PAGE - true - true - - - - DLQ - ExpiryQueue - 0 - - -1 - 10000 - 10 - PAGE - true - true - - - - -
- - - -
-
- - - -
- -
- -
-