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 58938db150..3162bb48b1 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); 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 new file mode 100644 index 0000000000..0a4b3819cc --- /dev/null +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/amqp-acceptor.txt @@ -0,0 +1,3 @@ + + + tcp://${host}:${amqp.port}?protocols=AMQP 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 21362c224a..a2982215d2 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} tcp://${host}:${default.port}?tcpSendBufferSize=1048576;tcpReceiveBufferSize=1048576 - - - tcp://${host}:${amqp.port}?protocols=AMQP - - - tcp://${host}:${stomp.port}?protocols=STOMP - - - tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP - - - tcp://${host}:${mqtt.port}?protocols=MQTT +${amqp-acceptor}${stomp-acceptor}${hornetq-acceptor}${mqtt-acceptor} ${cluster-security.settings}${cluster.settings}${replicated.settings}${shared-store.settings} 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 new file mode 100644 index 0000000000..3c0d804433 --- /dev/null +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/hornetq-acceptor.txt @@ -0,0 +1,3 @@ + + + tcp://${host}:${hq.port}?protocols=HORNETQ,STOMP 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 new file mode 100644 index 0000000000..bf383f8768 --- /dev/null +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/mqtt-acceptor.txt @@ -0,0 +1,3 @@ + + + tcp://${host}:${mqtt.port}?protocols=MQTT 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 new file mode 100644 index 0000000000..6c791651e8 --- /dev/null +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/stomp-acceptor.txt @@ -0,0 +1,3 @@ + + + tcp://${host}:${stomp.port}?protocols=STOMP 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 21579dc9b0..133680b4c2 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 { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index ee002298f6..082a3aa722 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -591,7 +591,7 @@ public abstract class ActiveMQTestBase extends Assert { break; } } - } while (i++ <= 30 && hasValue); + } while (i++ <= 50 && hasValue); for (WeakReference ref : references) { Assert.assertNull(ref.get()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java index 8b78f3d178..229136acd0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java @@ -332,7 +332,7 @@ public class FailoverTest extends FailoverTestBase { // https://issues.jboss.org/browse/HORNETQ-685 @Test public void testTimeoutOnFailoverTransactionCommit() throws Exception { - locator.setCallTimeout(2000).setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setAckBatchSize(0).setReconnectAttempts(-1); + locator.setCallTimeout(5000).setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setAckBatchSize(0).setReconnectAttempts(-1); ((InVMNodeManager) nodeManager).failoverPause = 5000L; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java index 4a9ca24d04..5595ddf657 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ActiveMQServerControlTest.java @@ -900,7 +900,7 @@ public class ActiveMQServerControlTest extends ManagementTestBase { ClientProducer producer1 = session.createProducer(random1); ClientProducer producer2 = session.createProducer(random2); - ClientMessage message = session.createMessage(false); + ClientMessage message = session.createMessage(true); producer1.send(message); producer2.send(message); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java index 49ed8a228a..cc6055f867 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDown3NodeTest.java @@ -347,12 +347,12 @@ public class ScaleDown3NodeTest extends ClusterTestBase { Assert.assertEquals(TEST_SIZE * 2, messageCount); for (int i = 0; i < TEST_SIZE; i++) { - ClientMessage clientMessage = consumers[0].getConsumer().receive(250); + ClientMessage clientMessage = consumers[0].getConsumer().receive(1000); Assert.assertNotNull(clientMessage); IntegrationTestLogger.LOGGER.info("Received: " + clientMessage); clientMessage.acknowledge(); - clientMessage = consumers[1].getConsumer().receive(250); + clientMessage = consumers[1].getConsumer().receive(1000); Assert.assertNotNull(clientMessage); IntegrationTestLogger.LOGGER.info("Received: " + clientMessage); clientMessage.acknowledge();