ARTEMIS-19 CLI option for message-load-balancing

This commit is contained in:
jbertram 2015-06-11 13:08:00 -05:00
parent 7a432afffe
commit fd85bf7f75
2 changed files with 20 additions and 0 deletions

View File

@ -37,6 +37,7 @@ import io.airlift.airline.Arguments;
import io.airlift.airline.Command; import io.airlift.airline.Command;
import io.airlift.airline.Option; import io.airlift.airline.Option;
import org.apache.activemq.artemis.core.asyncio.impl.AsynchronousFileImpl; import org.apache.activemq.artemis.core.asyncio.impl.AsynchronousFileImpl;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE; import static java.nio.file.attribute.PosixFilePermission.GROUP_EXECUTE;
import static java.nio.file.attribute.PosixFilePermission.GROUP_READ; import static java.nio.file.attribute.PosixFilePermission.GROUP_READ;
@ -106,6 +107,9 @@ public class Create extends InputAbstract
@Option(name = "--max-hops", description = "Number of hops on the cluster configuration") @Option(name = "--max-hops", description = "Number of hops on the cluster configuration")
int maxHops = 0; int maxHops = 0;
@Option(name = "--message-load-balancing", description = "What kind of message load balancing to use for clustered configurations. Can be ON_DEMAND, STRICT, or OFF. (Default: ON_DEMAND)")
String messageLoadBalancing = MessageLoadBalancingType.ON_DEMAND.toString();
@Option(name = "--replicated", description = "Enable broker replication") @Option(name = "--replicated", description = "Enable broker replication")
boolean replicated = false; boolean replicated = false;
@ -176,6 +180,16 @@ public class Create extends InputAbstract
this.portOffset = portOffset; this.portOffset = portOffset;
} }
public String getMessageLoadBalancing()
{
return messageLoadBalancing;
}
public void setMessageLoadBalancing(String messageLoadBalancing)
{
this.messageLoadBalancing = messageLoadBalancing;
}
public String getJavaOptions() public String getJavaOptions()
{ {
return javaOptions; return javaOptions;
@ -471,6 +485,11 @@ public class Create extends InputAbstract
filters.put("${http.port}", String.valueOf(HTTP_PORT + portOffset)); filters.put("${http.port}", String.valueOf(HTTP_PORT + portOffset));
filters.put("${data.dir}", data); filters.put("${data.dir}", data);
filters.put("${max-hops}", String.valueOf(maxHops)); filters.put("${max-hops}", String.valueOf(maxHops));
// validate message-load-balancing
Enum.valueOf(MessageLoadBalancingType.class, messageLoadBalancing);
filters.put("${message-load-balancing}", messageLoadBalancing);
filters.put("${user}", getUser()); filters.put("${user}", getUser());
filters.put("${password}", getPassword()); filters.put("${password}", getPassword());
filters.put("${role}", getRole()); filters.put("${role}", getRole());

View File

@ -20,6 +20,7 @@
<cluster-connection name="my-cluster"> <cluster-connection name="my-cluster">
<address>jms</address> <address>jms</address>
<connector-ref>artemis</connector-ref> <connector-ref>artemis</connector-ref>
<message-load-balancing>${message-load-balancing}</message-load-balancing>
<max-hops>${max-hops}</max-hops> <max-hops>${max-hops}</max-hops>
<discovery-group-ref discovery-group-name="dg-group1"/> <discovery-group-ref discovery-group-name="dg-group1"/>
</cluster-connection> </cluster-connection>