From 0bbe8c87f0d381ad883721f870875d610a314e62 Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Wed, 6 May 2015 08:46:34 +0100 Subject: [PATCH] add the ability to off set the defaul ports for the CLI create command --- .../activemq/artemis/cli/commands/Create.java | 15 +++++++++++++++ .../activemq/artemis/cli/commands/etc/broker.xml | 10 +++++----- 2 files changed, 20 insertions(+), 5 deletions(-) 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 4c09202475..099e737764 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 @@ -52,12 +52,23 @@ import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE; @Command(name = "create", description = "creates a new broker instance") public class Create implements Action { + private static final Integer DEFAULT_PORT = 61616; + + private static final Integer AMQP_PORT = 5672; + + private static final Integer STOMP_PORT = 61613; + + private static final Integer HQ_PORT = 5445; + @Arguments(description = "The instance directory to hold the broker's configuration and data", required = true) File directory; @Option(name = "--host", description = "The host name of the broker") String host; + @Option(name = "--port-offset", description = "Off sets the default ports") + int portOffset; + @Option(name = "--force", description = "Overwrite configuration at destination directory") boolean force; @@ -141,6 +152,10 @@ public class Create implements Action filters.put("${user}", System.getProperty("user.name", "")); filters.put("${host}", host); + filters.put("${default.port}", String.valueOf(DEFAULT_PORT + 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)); if (home != null) { filters.put("${home}", path(home, false)); 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 7b92851990..ed7ac67b01 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 @@ -38,21 +38,21 @@ under the License. - tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:61616} + tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:${default.port}} - tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:61616} + tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:${default.port}} - tcp://${activemq.remoting.amqp.host:${host}}:${activemq.remoting.amqp.port:5672}?protocols=AMQP + tcp://${activemq.remoting.amqp.host:${host}}:${activemq.remoting.amqp.port:${amqp.port}}?protocols=AMQP - tcp://${activemq.remoting.stomp.host:${host}}:${activemq.remoting.stomp.port:61613}?protocols=STOMP + tcp://${activemq.remoting.stomp.host:${host}}:${activemq.remoting.stomp.port:${stomp.port}}?protocols=STOMP - tcp://${activemq.remoting.hornetq.host:${host}}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP + tcp://${activemq.remoting.hornetq.host:${host}}:${activemq.remoting.hornetq.port:${hq.port}}?protocols=CORE,STOMP ${cluster.settings}${replicated.settings}${shared-store.settings}