add the ability to off set the defaul ports for the CLI create command
This commit is contained in:
parent
179903fe7d
commit
0bbe8c87f0
|
@ -52,12 +52,23 @@ import static java.nio.file.attribute.PosixFilePermission.OWNER_WRITE;
|
||||||
@Command(name = "create", description = "creates a new broker instance")
|
@Command(name = "create", description = "creates a new broker instance")
|
||||||
public class Create implements Action
|
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)
|
@Arguments(description = "The instance directory to hold the broker's configuration and data", required = true)
|
||||||
File directory;
|
File directory;
|
||||||
|
|
||||||
@Option(name = "--host", description = "The host name of the broker")
|
@Option(name = "--host", description = "The host name of the broker")
|
||||||
String host;
|
String host;
|
||||||
|
|
||||||
|
@Option(name = "--port-offset", description = "Off sets the default ports")
|
||||||
|
int portOffset;
|
||||||
|
|
||||||
@Option(name = "--force", description = "Overwrite configuration at destination directory")
|
@Option(name = "--force", description = "Overwrite configuration at destination directory")
|
||||||
boolean force;
|
boolean force;
|
||||||
|
|
||||||
|
@ -141,6 +152,10 @@ public class Create implements Action
|
||||||
|
|
||||||
filters.put("${user}", System.getProperty("user.name", ""));
|
filters.put("${user}", System.getProperty("user.name", ""));
|
||||||
filters.put("${host}", host);
|
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)
|
if (home != null)
|
||||||
{
|
{
|
||||||
filters.put("${home}", path(home, false));
|
filters.put("${home}", path(home, false));
|
||||||
|
|
|
@ -38,21 +38,21 @@ under the License.
|
||||||
|
|
||||||
<connectors>
|
<connectors>
|
||||||
<!-- Default Connector. Returned to clients during broadcast and distributed around cluster. See broadcast and discovery-groups -->
|
<!-- 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>
|
</connectors>
|
||||||
|
|
||||||
<acceptors>
|
<acceptors>
|
||||||
<!-- Default ActiveMQ Acceptor. Multi-protocol adapter. Currently supports Core, OpenWire, Stomp and AMQP. -->
|
<!-- 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.-->
|
<!-- 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. -->
|
<!-- 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. -->
|
<!-- 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>
|
</acceptors>
|
||||||
|
|
||||||
${cluster.settings}${replicated.settings}${shared-store.settings}
|
${cluster.settings}${replicated.settings}${shared-store.settings}
|
||||||
|
|
Loading…
Reference in New Issue