Repository: activemq-artemis Updated Branches: refs/heads/master dfdb35a2b -> ea5fc16c6
ARTEMIS-530 acceptor CLI config Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/643fa22d Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/643fa22d Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/643fa22d Branch: refs/heads/master Commit: 643fa22d05046c74aae2052807b92a955c89fda4 Parents: 76f6c9c Author: jbertram <[email protected]> Authored: Fri May 20 11:24:37 2016 -0500 Committer: jbertram <[email protected]> Committed: Fri May 20 11:24:55 2016 -0500 ---------------------------------------------------------------------- .../activemq/artemis/cli/commands/Create.java | 51 +++++++++++++++++++- .../artemis/cli/commands/etc/amqp-acceptor.txt | 9 +--- .../artemis/cli/commands/etc/broker.xml | 13 +---- .../cli/commands/etc/hornetq-acceptor.txt | 3 +- .../artemis/cli/commands/etc/mqtt-acceptor.txt | 9 +--- .../artemis/cli/commands/etc/stomp-acceptor.txt | 9 +--- .../activemq/cli/test/StreamClassPathTest.java | 4 ++ 7 files changed, 62 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java ---------------------------------------------------------------------- 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 58938db..3162bb4 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 @@ -85,6 +85,10 @@ public class Create extends InputAbstract { public static final String ETC_CONNECTOR_SETTINGS_TXT = "etc/connector-settings.txt"; public static final String ETC_BOOTSTRAP_WEB_SETTINGS_TXT = "etc/bootstrap-web-settings.txt"; public static final String ETC_JOURNAL_BUFFER_SETTINGS = "etc/journal-buffer-settings.txt"; + public static final String ETC_AMQP_ACCEPTOR_TXT = "etc/amqp-acceptor.txt"; + public static final String ETC_HORNETQ_ACCEPTOR_TXT = "etc/hornetq-acceptor.txt"; + public static final String ETC_MQTT_ACCEPTOR_TXT = "etc/mqtt-acceptor.txt"; + public static final String ETC_STOMP_ACCEPTOR_TXT = "etc/stomp-acceptor.txt"; @Arguments(description = "The instance directory to hold the broker's configuration and data. Path must be writable.", required = true) File directory; @@ -92,10 +96,13 @@ public class Create extends InputAbstract { @Option(name = "--host", description = "The host name of the broker (Default: 0.0.0.0 or input if clustered)") String host; + @Option(name = "--default-port", description = "The port number to use for the main 'artemis' acceptor (Default: 61616)") + int defaultPort = DEFAULT_PORT; + @Option(name = "--name", description = "The name of the broker (Default: same as host)") String name; - @Option(name = "--port-offset", description = "Off sets the default ports") + @Option(name = "--port-offset", description = "Off sets the ports of every acceptor") int portOffset; @Option(name = "--force", description = "Overwrite configuration at destination directory") @@ -176,6 +183,18 @@ public class Create extends InputAbstract { @Option(name = "--disable-persistence", description = "Disable message persistence to the journal") boolean disablePersistence; + @Option(name = "--no-amqp-acceptor", description = "Disable the AMQP specific acceptor.") + boolean noAmqpAcceptor; + + @Option(name = "--no-mqtt-acceptor", description = "Disable the MQTT specific acceptor.") + boolean noMqttAcceptor; + + @Option(name = "--no-stomp-acceptor", description = "Disable the STOMP specific acceptor.") + boolean noStompAcceptor; + + @Option(name = "--no-hornetq-acceptor", description = "Disable the HornetQ specific acceptor.") + boolean noHornetQAcceptor; + boolean IS_WINDOWS; boolean IS_CYGWIN; @@ -500,7 +519,7 @@ public class Create extends InputAbstract { } filters.put("${user}", System.getProperty("user.name", "")); - filters.put("${default.port}", String.valueOf(DEFAULT_PORT + portOffset)); + filters.put("${default.port}", String.valueOf(defaultPort + portOffset)); filters.put("${amqp.port}", String.valueOf(AMQP_PORT + portOffset)); filters.put("${stomp.port}", String.valueOf(STOMP_PORT + portOffset)); filters.put("${hq.port}", String.valueOf(HQ_PORT + portOffset)); @@ -602,6 +621,34 @@ public class Create extends InputAbstract { filters.put("${bootstrap-web-settings}", applyFilters(readTextFile(ETC_BOOTSTRAP_WEB_SETTINGS_TXT), filters)); } + if (noAmqpAcceptor) { + filters.put("${amqp-acceptor}", ""); + } + else { + filters.put("${amqp-acceptor}", applyFilters(readTextFile(ETC_AMQP_ACCEPTOR_TXT), filters)); + } + + if (noMqttAcceptor) { + filters.put("${mqtt-acceptor}", ""); + } + else { + filters.put("${mqtt-acceptor}", applyFilters(readTextFile(ETC_MQTT_ACCEPTOR_TXT), filters)); + } + + if (noStompAcceptor) { + filters.put("${stomp-acceptor}", ""); + } + else { + filters.put("${stomp-acceptor}", applyFilters(readTextFile(ETC_STOMP_ACCEPTOR_TXT), filters)); + } + + if (noHornetQAcceptor) { + filters.put("${hornetq-acceptor}", ""); + } + else { + filters.put("${hornetq-acceptor}", applyFilters(readTextFile(ETC_HORNETQ_ACCEPTOR_TXT), filters)); + } + performAutoTune(filters, aio, dataFolder); write(ETC_BROKER_XML, filters, false); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt index 566c29e..0a4b381 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt @@ -1,8 +1,3 @@ - <!-- - This value was determined through a calculation. - Your system could perform ${writesPerMillisecond} writes per millisecond - on the current journal configuration. - That translates as a sync write every ${nanoseconds} nanoseconds - --> - <journal-buffer-timeout>${nanoseconds}</journal-buffer-timeout> + <!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.--> + <acceptor name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml index 21362c2..a298221 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/broker.xml @@ -54,18 +54,7 @@ ${connector-config.settings} <!-- Default ActiveMQ Artemis Acceptor. Multi-protocol adapter. Currently supports ActiveMQ Artemis Core, OpenWire, STOMP, AMQP, MQTT, and HornetQ Core. --> <!-- performance tests have shown that openWire performs best with these buffer sizes --> <acceptor name="artemis">tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576</acceptor> - - <!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.--> - <acceptor name="amqp">tcp://${host}:${amqp.port}?protocols=AMQP</acceptor> - - <!-- STOMP Acceptor. --> - <acceptor name="stomp">tcp://${host}:${stomp.port}?protocols=STOMP</acceptor> - - <!-- HornetQ Compatibility Acceptor. Enables HornetQ Core and STOMP for legacy HornetQ clients. --> - <acceptor name="hornetq">tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP</acceptor> - - <!-- MQTT Acceptor --> - <acceptor name="mqtt">tcp://${host}:${mqtt.port}?protocols=MQTT</acceptor> +${amqp-acceptor}${stomp-acceptor}${hornetq-acceptor}${mqtt-acceptor} </acceptors> ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-store.settings} http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt index e24b102..3c0d804 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt @@ -1,2 +1,3 @@ + <!-- HornetQ Compatibility Acceptor. Enables HornetQ Core and STOMP for legacy HornetQ clients. --> - <acceptor name="hornetq">tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP</acceptor> \ No newline at end of file + <acceptor name="hornetq">tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP</acceptor> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt index 566c29e..bf383f8 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt @@ -1,8 +1,3 @@ - <!-- - This value was determined through a calculation. - Your system could perform ${writesPerMillisecond} writes per millisecond - on the current journal configuration. - That translates as a sync write every ${nanoseconds} nanoseconds - --> - <journal-buffer-timeout>${nanoseconds}</journal-buffer-timeout> + <!-- MQTT Acceptor --> + <acceptor name="mqtt">tcp://${host}:${mqtt.port}?protocols=MQTT</acceptor> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt ---------------------------------------------------------------------- diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt index 566c29e..6c79165 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt @@ -1,8 +1,3 @@ - <!-- - This value was determined through a calculation. - Your system could perform ${writesPerMillisecond} writes per millisecond - on the current journal configuration. - That translates as a sync write every ${nanoseconds} nanoseconds - --> - <journal-buffer-timeout>${nanoseconds}</journal-buffer-timeout> + <!-- STOMP Acceptor. --> + <acceptor name="stomp">tcp://${host}:${stomp.port}?protocols=STOMP</acceptor> http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/643fa22d/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java ---------------------------------------------------------------------- diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java index 21579dc..133680b 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/StreamClassPathTest.java @@ -50,6 +50,10 @@ public class StreamClassPathTest { openStream(Create.ETC_CONNECTOR_SETTINGS_TXT); openStream(Create.ETC_BOOTSTRAP_WEB_SETTINGS_TXT); openStream(Create.ETC_JOURNAL_BUFFER_SETTINGS); + openStream(Create.ETC_AMQP_ACCEPTOR_TXT); + openStream(Create.ETC_MQTT_ACCEPTOR_TXT); + openStream(Create.ETC_HORNETQ_ACCEPTOR_TXT); + openStream(Create.ETC_STOMP_ACCEPTOR_TXT); } private void openStream(String source) throws Exception {
