add the ability to off set the defaul ports for the CLI create command

This commit is contained in:
Andy Taylor 2015-05-06 08:46:34 +01:00
parent 179903fe7d
commit 0bbe8c87f0
2 changed files with 20 additions and 5 deletions

View File

@ -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));

View File

@ -38,21 +38,21 @@ under the License.
<connectors>
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
<connector name="activemq">tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:61616}</connector>
<connector name="activemq">tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:${default.port}}</connector>
</connectors>
<acceptors>
<!-- Default ActiveMQ Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
<acceptor name="activemq">tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:61616}</acceptor>
<acceptor name="activemq">tcp://${activemq.remoting.default.host:${host}}:${activemq.remoting.default.port:${default.port}}</acceptor>
<!-- AMQP Acceptor. Listens on default AMQP port for AMQP traffic.-->
<acceptor name="amqp">tcp://${activemq.remoting.amqp.host:${host}}:${activemq.remoting.amqp.port:5672}?protocols=AMQP</acceptor>
<acceptor name="amqp">tcp://${activemq.remoting.amqp.host:${host}}:${activemq.remoting.amqp.port:${amqp.port}}?protocols=AMQP</acceptor>
<!-- STOMP Acceptor. -->
<acceptor name="stomp">tcp://${activemq.remoting.stomp.host:${host}}:${activemq.remoting.stomp.port:61613}?protocols=STOMP</acceptor>
<acceptor name="stomp">tcp://${activemq.remoting.stomp.host:${host}}:${activemq.remoting.stomp.port:${stomp.port}}?protocols=STOMP</acceptor>
<!-- HornetQ Compatibility Acceptor. Enables ActiveMQ Core and STOMP for legacy HornetQ clients. -->
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:${host}}:${activemq.remoting.hornetq.port:5445}?protocols=CORE,STOMP</acceptor>
<acceptor name="hornetq">tcp://${activemq.remoting.hornetq.host:${host}}:${activemq.remoting.hornetq.port:${hq.port}}?protocols=CORE,STOMP</acceptor>
</acceptors>
${cluster.settings}${replicated.settings}${shared-store.settings}