diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java index 720a516a23..5752a5b707 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/config/ActiveMQDefaultConfiguration.java @@ -339,9 +339,11 @@ public final class ActiveMQDefaultConfiguration // should duplicate detection headers be inserted in forwarded messages? private static boolean DEFAULT_CLUSTER_DUPLICATE_DETECTION = true; - // should messages be load balanced if there are no matching consumers on target? private static boolean DEFAULT_CLUSTER_FORWARD_WHEN_NO_CONSUMERS = false; + // how should messages be load balanced? + private static String DEFAULT_CLUSTER_MESSAGE_LOAD_BALANCING_TYPE = "ON_DEMAND"; + // maximum number of hops cluster topology is propagated private static int DEFAULT_CLUSTER_MAX_HOPS = 1; @@ -950,14 +952,19 @@ public final class ActiveMQDefaultConfiguration return DEFAULT_CLUSTER_DUPLICATE_DETECTION; } - /** - * should messages be load balanced if there are no matching consumers on target? - */ public static boolean isDefaultClusterForwardWhenNoConsumers() { return DEFAULT_CLUSTER_FORWARD_WHEN_NO_CONSUMERS; } + /** + * should messages be load balanced if there are no matching consumers on target? + */ + public static String getDefaultClusterMessageLoadBalancingType() + { + return DEFAULT_CLUSTER_MESSAGE_LOAD_BALANCING_TYPE; + } + /** * maximum number of hops cluster topology is propagated */ diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ClusterConnectionControl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ClusterConnectionControl.java index aaf7e0ba50..5767bf603c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ClusterConnectionControl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ClusterConnectionControl.java @@ -46,7 +46,7 @@ public interface ClusterConnectionControl extends ActiveMQComponentControl /** * Return whether this cluster connection forward messages when it has no local consumers. */ - boolean isForwardWhenNoConsumers(); + String getMessageLoadBalancingType(); /** * Return the Topology that this Cluster Connection knows about diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java index 01c46eb4ab..ccb3e7c7e2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/ClusterConnectionConfiguration.java @@ -16,13 +16,14 @@ */ package org.apache.activemq.artemis.core.config; +import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; +import org.apache.activemq.artemis.api.core.client.ActiveMQClient; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; + import java.io.Serializable; import java.util.Collections; import java.util.List; -import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; -import org.apache.activemq.artemis.api.core.client.ActiveMQClient; - public final class ClusterConnectionConfiguration implements Serializable { private static final long serialVersionUID = 8948303813427795935L; @@ -53,7 +54,7 @@ public final class ClusterConnectionConfiguration implements Serializable private boolean duplicateDetection = ActiveMQDefaultConfiguration.isDefaultClusterDuplicateDetection(); - private boolean forwardWhenNoConsumers = ActiveMQDefaultConfiguration.isDefaultClusterForwardWhenNoConsumers(); + private MessageLoadBalancingType messageLoadBalancingType = Enum.valueOf(MessageLoadBalancingType.class, ActiveMQDefaultConfiguration.getDefaultClusterMessageLoadBalancingType()); private List staticConnectors = Collections.emptyList(); @@ -171,9 +172,9 @@ public final class ClusterConnectionConfiguration implements Serializable return duplicateDetection; } - public boolean isForwardWhenNoConsumers() + public MessageLoadBalancingType getMessageLoadBalancingType() { - return forwardWhenNoConsumers; + return messageLoadBalancingType; } public int getMaxHops() @@ -345,11 +346,12 @@ public final class ClusterConnectionConfiguration implements Serializable } /** - * @param forwardWhenNoConsumers the forwardWhenNoConsumers to set + * @param messageLoadBalancingType + * @return */ - public ClusterConnectionConfiguration setForwardWhenNoConsumers(boolean forwardWhenNoConsumers) + public ClusterConnectionConfiguration setMessageLoadBalancingType(MessageLoadBalancingType messageLoadBalancingType) { - this.forwardWhenNoConsumers = forwardWhenNoConsumers; + this.messageLoadBalancingType = messageLoadBalancingType; return this; } @@ -395,7 +397,7 @@ public final class ClusterConnectionConfiguration implements Serializable result = prime * result + ((connectorName == null) ? 0 : connectorName.hashCode()); result = prime * result + ((discoveryGroupName == null) ? 0 : discoveryGroupName.hashCode()); result = prime * result + (duplicateDetection ? 1231 : 1237); - result = prime * result + (forwardWhenNoConsumers ? 1231 : 1237); + result = prime * result + (messageLoadBalancingType == null ? 0 : messageLoadBalancingType.hashCode()); result = prime * result + maxHops; result = prime * result + (int)(maxRetryInterval ^ (maxRetryInterval >>> 32)); result = prime * result + minLargeMessageSize; @@ -459,7 +461,7 @@ public final class ClusterConnectionConfiguration implements Serializable return false; if (duplicateDetection != other.duplicateDetection) return false; - if (forwardWhenNoConsumers != other.forwardWhenNoConsumers) + if (messageLoadBalancingType != other.messageLoadBalancingType) return false; if (maxHops != other.maxHops) return false; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java index e24d9dc4db..97c2d4b712 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/Validators.java @@ -18,6 +18,7 @@ package org.apache.activemq.artemis.core.config.impl; import org.apache.activemq.artemis.core.server.ActiveMQMessageBundle; import org.apache.activemq.artemis.core.server.JournalType; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy; @@ -176,10 +177,24 @@ public final class Validators { String val = (String) value; if (val == null || !val.equals(SlowConsumerPolicy.KILL.toString()) && - !val.equals(SlowConsumerPolicy.NOTIFY.toString())) + !val.equals(SlowConsumerPolicy.NOTIFY.toString())) { throw ActiveMQMessageBundle.BUNDLE.invalidSlowConsumerPolicyType(val); } } }; + + public static final Validator MESSAGE_LOAD_BALANCING_TYPE = new Validator() + { + public void validate(final String name, final Object value) + { + String val = (String) value; + if (val == null || !val.equals(MessageLoadBalancingType.OFF.toString()) && + !val.equals(MessageLoadBalancingType.STRICT.toString()) && + !val.equals(MessageLoadBalancingType.ON_DEMAND.toString())) + { + throw ActiveMQMessageBundle.BUNDLE.invalidMessageLoadBalancingType(val); + } + } + }; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 44da6b5ac1..3d68b19e07 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -16,16 +16,6 @@ */ package org.apache.activemq.artemis.core.deployers.impl; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - import org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration; import org.apache.activemq.artemis.api.core.BroadcastEndpointFactory; import org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration; @@ -56,6 +46,7 @@ import org.apache.activemq.artemis.core.journal.impl.JournalConstants; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; import org.apache.activemq.artemis.core.server.JournalType; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration; import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy; import org.apache.activemq.artemis.core.settings.impl.AddressSettings; @@ -73,6 +64,16 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + /** * Parses an XML document according to the {@literal artemis-configuration.xsd} schema. */ @@ -1159,7 +1160,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil configuration.setClusterName(getString(policyNode, "cluster-name", configuration.getClusterName(), Validators.NO_CHECK)); configuration.setMaxSavedReplicatedJournalsSize(getInteger(policyNode, "max-saved-replicated-journals-size", - configuration.getMaxSavedReplicatedJournalsSize(), Validators.MINUS_ONE_OR_GE_ZERO)); + configuration.getMaxSavedReplicatedJournalsSize(), Validators.MINUS_ONE_OR_GE_ZERO)); configuration.setScaleDownConfiguration(parseScaleDownConfig(policyNode)); @@ -1430,9 +1431,29 @@ public final class FileConfigurationParser extends XMLConfigurationUtil boolean duplicateDetection = getBoolean(e, "use-duplicate-detection", ActiveMQDefaultConfiguration.isDefaultClusterDuplicateDetection()); - boolean forwardWhenNoConsumers = - getBoolean(e, "forward-when-no-consumers", - ActiveMQDefaultConfiguration.isDefaultClusterForwardWhenNoConsumers()); + MessageLoadBalancingType messageLoadBalancingType; + + if (parameterExists(e, "forward-when-no-consumers")) + { + boolean forwardWhenNoConsumers = getBoolean(e, "forward-when-no-consumers", + ActiveMQDefaultConfiguration.isDefaultClusterForwardWhenNoConsumers()); + if (forwardWhenNoConsumers) + { + messageLoadBalancingType = MessageLoadBalancingType.STRICT; + } + else + { + messageLoadBalancingType = MessageLoadBalancingType.ON_DEMAND; + } + } + else + { + + messageLoadBalancingType = Enum.valueOf(MessageLoadBalancingType.class, + getString(e, "message-load-balancing", + ActiveMQDefaultConfiguration.getDefaultClusterMessageLoadBalancingType(), + Validators.MESSAGE_LOAD_BALANCING_TYPE)); + } int maxHops = getInteger(e, "max-hops", ActiveMQDefaultConfiguration.getDefaultClusterMaxHops(), @@ -1519,7 +1540,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil .setCallTimeout(callTimeout) .setCallFailoverTimeout(callFailoverTimeout) .setDuplicateDetection(duplicateDetection) - .setForwardWhenNoConsumers(forwardWhenNoConsumers) + .setMessageLoadBalancingType(messageLoadBalancingType) .setMaxHops(maxHops) .setConfirmationWindowSize(confirmationWindowSize) .setAllowDirectConnectionsOnly(allowDirectConnectionsOnly) diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ClusterConnectionControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ClusterConnectionControlImpl.java index 48ec90f59b..e08474c3a5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ClusterConnectionControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ClusterConnectionControlImpl.java @@ -194,12 +194,12 @@ public class ClusterConnectionControlImpl extends AbstractControl implements Clu } } - public boolean isForwardWhenNoConsumers() + public String getMessageLoadBalancingType() { clearIO(); try { - return configuration.isForwardWhenNoConsumers(); + return configuration.getMessageLoadBalancingType().getType(); } finally { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java index febc06d7dd..1f6613c833 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/Bindings.java @@ -21,6 +21,7 @@ import java.util.Collection; import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.ServerMessage; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.group.UnproposalListener; public interface Bindings extends UnproposalListener @@ -31,7 +32,7 @@ public interface Bindings extends UnproposalListener void removeBinding(Binding binding); - void setRouteWhenNoConsumers(boolean takePriorityIntoAccount); + void setMessageLoadBalancingType(MessageLoadBalancingType messageLoadBalancingType); boolean redistribute(ServerMessage message, Queue originatingQueue, RoutingContext context) throws Exception; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java index 268c198c59..9d3d2bc38b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java @@ -39,6 +39,7 @@ import org.apache.activemq.artemis.core.server.Queue; import org.apache.activemq.artemis.core.server.RoutingContext; import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.group.GroupingHandler; import org.apache.activemq.artemis.core.server.group.impl.Proposal; import org.apache.activemq.artemis.core.server.group.impl.Response; @@ -58,7 +59,7 @@ public final class BindingsImpl implements Bindings private final List exclusiveBindings = new CopyOnWriteArrayList(); - private volatile boolean routeWhenNoConsumers; + private volatile MessageLoadBalancingType messageLoadBalancingType = MessageLoadBalancingType.OFF; private final GroupingHandler groupingHandler; @@ -73,9 +74,9 @@ public final class BindingsImpl implements Bindings this.name = name; } - public void setRouteWhenNoConsumers(final boolean routeWhenNoConsumers) + public void setMessageLoadBalancingType(final MessageLoadBalancingType messageLoadBalancingType) { - this.routeWhenNoConsumers = routeWhenNoConsumers; + this.messageLoadBalancingType = messageLoadBalancingType; } public Collection getBindings() @@ -164,7 +165,7 @@ public final class BindingsImpl implements Bindings public boolean redistribute(final ServerMessage message, final Queue originatingQueue, final RoutingContext context) throws Exception { - if (routeWhenNoConsumers) + if (messageLoadBalancingType.equals(MessageLoadBalancingType.STRICT) || messageLoadBalancingType.equals(MessageLoadBalancingType.OFF)) { return false; } @@ -409,7 +410,7 @@ public final class BindingsImpl implements Bindings { // bindings.length == 1 ==> only a local queue so we don't check for matching consumers (it's an // unnecessary overhead) - if (length == 1 || (binding.isConnected() && (routeWhenNoConsumers || binding.isHighAcceptPriority(message)))) + if (length == 1 || (binding.isConnected() && (messageLoadBalancingType.equals(MessageLoadBalancingType.STRICT) || binding.isHighAcceptPriority(message)))) { theBinding = binding; @@ -421,7 +422,7 @@ public final class BindingsImpl implements Bindings { //https://issues.jboss.org/browse/HORNETQ-1254 When !routeWhenNoConsumers, // the localQueue should always have the priority over the secondary bindings - if (lastLowPriorityBinding == -1 || !routeWhenNoConsumers && binding instanceof LocalQueueBinding) + if (lastLowPriorityBinding == -1 || messageLoadBalancingType.equals(MessageLoadBalancingType.ON_DEMAND) && binding instanceof LocalQueueBinding) { lastLowPriorityBinding = pos; } @@ -466,6 +467,11 @@ public final class BindingsImpl implements Bindings { routingNamePositions.put(routingName, pos); } + + if (messageLoadBalancingType.equals(MessageLoadBalancingType.OFF) && theBinding instanceof RemoteQueueBinding) + { + theBinding = getNextBinding(message, routingName, bindings); + } return theBinding; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java index 87c3a8b4bf..bc5b9824c9 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQMessageBundle.java @@ -362,4 +362,7 @@ public interface ActiveMQMessageBundle @Message(id = 119112, value = "Cannot set MBeanServer during startup or while started") IllegalStateException cannotSetMBeanserver(); + + @Message(id = 119113, value = "Invalid message load balancing type {0}", format = Message.Format.MESSAGE_FORMAT) + IllegalArgumentException invalidMessageLoadBalancingType(String val); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 4a3c39db8b..51cedfef23 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -733,7 +733,7 @@ public final class ClusterManager implements ActiveMQComponent config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), - config.isForwardWhenNoConsumers(), + config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), executorFactory, server, @@ -775,7 +775,7 @@ public final class ClusterManager implements ActiveMQComponent config.getCallTimeout(), config.getCallFailoverTimeout(), config.isDuplicateDetection(), - config.isForwardWhenNoConsumers(), + config.getMessageLoadBalancingType(), config.getConfirmationWindowSize(), executorFactory, server, diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java index 02e4327fcb..9caf330092 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java @@ -109,7 +109,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn private final boolean useDuplicateDetection; - private final boolean routeWhenNoConsumers; + private final MessageLoadBalancingType messageLoadBalancingType; private final int confirmationWindowSize; @@ -177,7 +177,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn final long callTimeout, final long callFailoverTimeout, final boolean useDuplicateDetection, - final boolean routeWhenNoConsumers, + final MessageLoadBalancingType messageLoadBalancingType, final int confirmationWindowSize, final ExecutorFactory executorFactory, final ActiveMQServer server, @@ -216,7 +216,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn this.useDuplicateDetection = useDuplicateDetection; - this.routeWhenNoConsumers = routeWhenNoConsumers; + this.messageLoadBalancingType = messageLoadBalancingType; this.confirmationWindowSize = confirmationWindowSize; @@ -284,7 +284,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn final long callTimeout, final long callFailoverTimeout, final boolean useDuplicateDetection, - final boolean routeWhenNoConsumers, + final MessageLoadBalancingType messageLoadBalancingType, final int confirmationWindowSize, final ExecutorFactory executorFactory, final ActiveMQServer server, @@ -329,7 +329,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn this.useDuplicateDetection = useDuplicateDetection; - this.routeWhenNoConsumers = routeWhenNoConsumers; + this.messageLoadBalancingType = messageLoadBalancingType; this.confirmationWindowSize = confirmationWindowSize; @@ -1388,7 +1388,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn Bindings theBindings = postOffice.getBindingsForAddress(queueAddress); - theBindings.setRouteWhenNoConsumers(routeWhenNoConsumers); + theBindings.setMessageLoadBalancingType(messageLoadBalancingType); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/MessageLoadBalancingType.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/MessageLoadBalancingType.java new file mode 100644 index 0000000000..38df1a23f0 --- /dev/null +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/MessageLoadBalancingType.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + *

+ * http://www.apache.org/licenses/LICENSE-2.0 + *

+ * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.artemis.core.server.cluster.impl; + +public enum MessageLoadBalancingType +{ + OFF("OFF"), STRICT("STRICT"), ON_DEMAND("ON_DEMAND"); + + private String type; + + MessageLoadBalancingType(final String type) + { + this.type = type; + } + + public String getType() + { + return type; + } +} \ No newline at end of file diff --git a/artemis-server/src/main/resources/schema/artemis-configuration.xsd b/artemis-server/src/main/resources/schema/artemis-configuration.xsd index b86b0b1b62..af28c092fc 100644 --- a/artemis-server/src/main/resources/schema/artemis-configuration.xsd +++ b/artemis-server/src/main/resources/schema/artemis-configuration.xsd @@ -1223,11 +1223,27 @@ - should messages be load balanced if there are no matching consumers on target? + DEPRECATED: use message-load-balancing-type instead. Select STRICT to mimic foward-when-no-consumers=true + and ON_DEMAND to mimic forward-when-no-consumers=false. + + + + how should messages be load balanced between servers in a cluster? + + + + + + + + + + + diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java index 0b232a2ab3..94118ebdc0 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationTest.java @@ -39,6 +39,7 @@ import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration; import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants; import org.apache.activemq.artemis.core.security.Role; import org.apache.activemq.artemis.core.server.JournalType; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.settings.impl.SlowConsumerPolicy; import org.junit.Assert; import org.junit.Test; @@ -260,7 +261,7 @@ public class FileConfigurationTest extends ConfigurationImplTest Assert.assertEquals("queues1", ccc.getAddress()); Assert.assertEquals(3, ccc.getRetryInterval()); Assert.assertEquals(true, ccc.isDuplicateDetection()); - Assert.assertEquals(false, ccc.isForwardWhenNoConsumers()); + Assert.assertEquals(MessageLoadBalancingType.ON_DEMAND, ccc.getMessageLoadBalancingType()); Assert.assertEquals(1, ccc.getMaxHops()); Assert.assertEquals(123, ccc.getCallTimeout()); Assert.assertEquals(123, ccc.getCallFailoverTimeout()); @@ -279,7 +280,7 @@ public class FileConfigurationTest extends ConfigurationImplTest Assert.assertEquals(456, ccc.getCallTimeout()); Assert.assertEquals(456, ccc.getCallFailoverTimeout()); Assert.assertEquals(false, ccc.isDuplicateDetection()); - Assert.assertEquals(true, ccc.isForwardWhenNoConsumers()); + Assert.assertEquals(MessageLoadBalancingType.STRICT, ccc.getMessageLoadBalancingType()); Assert.assertEquals(2, ccc.getMaxHops()); Assert.assertEquals(Collections.emptyList(), ccc.getStaticConnectors()); Assert.assertEquals("dg1", ccc.getDiscoveryGroupName()); 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 69cbcda3cc..bb03d92629 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 @@ -109,6 +109,7 @@ import org.apache.activemq.artemis.core.server.ServerMessage; import org.apache.activemq.artemis.core.server.cluster.ClusterConnection; import org.apache.activemq.artemis.core.server.cluster.ClusterManager; import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; import org.apache.activemq.artemis.core.server.impl.Activation; import org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl; import org.apache.activemq.artemis.core.server.impl.ServerMessageImpl; @@ -525,9 +526,9 @@ public abstract class ActiveMQTestBase extends Assert .setConnectorName(connectorName) .setRetryInterval(1000) .setDuplicateDetection(false) - .setForwardWhenNoConsumers(true) .setMaxHops(1) .setConfirmationWindowSize(1) + .setMessageLoadBalancingType(MessageLoadBalancingType.STRICT) .setStaticConnectors(connectors0); return clusterConnectionConfiguration; diff --git a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml index 0f81b759e7..0514788152 100644 --- a/artemis-server/src/test/resources/ConfigurationTest-full-config.xml +++ b/artemis-server/src/test/resources/ConfigurationTest-full-config.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../../../activemq-server/src/main/resources/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer false @@ -65,16 +65,16 @@ tcp://0.0.0.0:61616?tcpNoDelay=456;connectionTtl=44;connectionsAllowed=92 - vm://0?e1=z1;e2=567;connectionsAllowed=87 + vm://0?e1=z1;e2=567;connectionsAllowed=87 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -118,38 +118,38 @@

address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + @@ -167,35 +167,35 @@ -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
@@ -225,7 +225,7 @@ 95 54321 largemessagesdir - + diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest0.xml b/artemis-server/src/test/resources/InvalidConfigurationTest0.xml index e92eb56999..db2c2d3888 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest0.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest0.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -76,17 +76,17 @@ tcp://localhost:61616 - vm://0 + vm://0 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -130,102 +130,102 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - AA - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + AA + +
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest1.xml b/artemis-server/src/test/resources/InvalidConfigurationTest1.xml index debdc10876..907ff3408c 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest1.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest1.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -76,17 +76,17 @@ tcp://localhost:61616 - vm://0 + vm://0 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -130,102 +130,102 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - 8 - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + 8 + +
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest2.xml b/artemis-server/src/test/resources/InvalidConfigurationTest2.xml index 26484d22cb..b95c10e8a4 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest2.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest2.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -76,17 +76,17 @@ tcp://localhost:61616 - vm://0 + vm://0 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -130,103 +130,103 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - 8 - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + 8 + +
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest3.xml b/artemis-server/src/test/resources/InvalidConfigurationTest3.xml index 49f6d44749..000211ad0a 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest3.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest3.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -80,13 +80,13 @@ - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -131,102 +131,102 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - 8 - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + 8 + +
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest4.xml b/artemis-server/src/test/resources/InvalidConfigurationTest4.xml index 032fd7e78b..b50ebb20bd 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest4.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest4.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -76,17 +76,17 @@ tcp://localhost:61616 - vm://0 + vm://0 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -130,101 +130,101 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + - connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - connector1 - connector2 - + 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 + -
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - 8 - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + 8 + +
diff --git a/artemis-server/src/test/resources/InvalidConfigurationTest5.xml b/artemis-server/src/test/resources/InvalidConfigurationTest5.xml index 3d32ac43ee..88590b1c34 100644 --- a/artemis-server/src/test/resources/InvalidConfigurationTest5.xml +++ b/artemis-server/src/test/resources/InvalidConfigurationTest5.xml @@ -15,9 +15,9 @@ limitations under the License. --> + xmlns="urn:activemq" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="urn:activemq ../../src/config/common/schema/artemis-server.xsd"> SomeNameForUseOnTheApplicationServer 12345 @@ -76,17 +76,17 @@ tcp://localhost:61616 - vm://0 + vm://0 - - 10999 - 192.168.0.120 - 11999 + + 10999 + 192.168.0.120 + 11999 12345 connector1 - + 12999 192.168.0.121 @@ -130,104 +130,104 @@
address1
- + false
address2
- + false
- queue1 - bridge-forwarding-address1 - - org.foo.BridgeTransformer - 4 - 31 - 370 - 3 - 0.2 - 10002 - 2 - 2 - 2 - false - true - + queue1 + bridge-forwarding-address1 + + org.foo.BridgeTransformer + 4 + 31 + 370 + 3 + 0.2 + 10002 + 2 + 2 + 2 + false + true + connector1 - + - queue2 - bridge-forwarding-address2 - + queue2 + bridge-forwarding-address2 + -
queues1
- connector1 - 331 - 3370 - 321 - 123 - 3 - 0.25 - 10000 - 72 - true - false - 1 - 123 - +
queues1
connector1 - connector2 -
+ 331 + 3370 + 321 + 123 + 3 + 0.25 + 10000 + 72 + true + ON_DEMAND + 1 + 123 + + connector1 + connector2 +
-
queues2
- connector2 - 456 - 4 - false - true - 2 - 456 - +
queues2
+ connector2 + 456 + 4 + false + STRICT + 2 + 456 +
- - - - - - - - + + + + + + + + - - - a1.1 - a1.2 - 1 - 81781728121878 - 81738173872337 - 10 - 4 - - - a2.1 - a2.2 - 5 - 932489234928324 - 7126716262626 - 20 - 8 - - + + + a1.1 + a1.2 + 1 + 81781728121878 + 81738173872337 + 10 + 4 + + + a2.1 + a2.2 + 5 + 932489234928324 + 7126716262626 + 20 + 8 + +
diff --git a/docs/user-manual/en/clusters.md b/docs/user-manual/en/clusters.md index c2dbeb3195..1998ec2b43 100644 --- a/docs/user-manual/en/clusters.md +++ b/docs/user-manual/en/clusters.md @@ -568,7 +568,7 @@ server. -1 -1 true - false + ON_DEMAND 1 32000 30000 @@ -695,26 +695,32 @@ specified. The following shows all the available configuration options a bridge. For more information on duplicate detection, please see [Duplicate Detection](duplicate-detection.md). Default is true. -- `forward-when-no-consumers`. This parameter determines whether - messages will be distributed round robin between other nodes of the - cluster *regardless* of whether or not there are matching or indeed - any consumers on other nodes. +- `message-load-balancing`. This parameter determines if/how + messages will be distributed between other nodes of the cluster. + It can be one of three values - `OFF`, `STRICT`, or `ON_DEMAND` + (default). This parameter replaces the deprecated + `forward-when-no-consumers` parameter. + + If this is set to `OFF` then messages will never be forwarded to + another node in the cluster - If this is set to `true` then each incoming message will be round + If this is set to `STRICT` then each incoming message will be round robin'd even though the same queues on the other nodes of the cluster may have no consumers at all, or they may have consumers that have non matching message filters (selectors). Note that - Apache ActiveMQ Artemis will *not* forward messages to other nodes if there are no - *queues* of the same name on the other nodes, even if this parameter - is set to `true`. + Apache ActiveMQ Artemis will *not* forward messages to other nodes + if there are no *queues* of the same name on the other nodes, even + if this parameter is set to `STRICT`. Using `STRICT` is like setting + the legacy `foward-when-no-consumers` parameter to `true`. - If this is set to `false` then Apache ActiveMQ Artemis will only forward messages - to other nodes of the cluster if the address to which they are being - forwarded has queues which have consumers, and if those consumers - have message filters (selectors) at least one of those selectors - must match the message. + If this is set to `ON_DEMAND` then Apache ActiveMQ Artemis will only + forward messages to other nodes of the cluster if the address to which + they are being forwarded has queues which have consumers, and if those + consumers have message filters (selectors) at least one of those + selectors must match the message. Using `ON_DEMAND` is like setting + the legacy `foward-when-no-consumers` parameter to `false`. - Default is false. + Default is `ON_DEMAND`. - `max-hops`. When a cluster connection decides the set of nodes to which it might load balance a message, those nodes do not have to be @@ -886,7 +892,7 @@ and is configured as follows: netty-connector 500 true - true + STRICT 1 server1-connector @@ -902,10 +908,10 @@ This means you can explicitly create any cluster topology you want. Another important part of clustering is message redistribution. Earlier we learned how server side message load balancing round robins messages -across the cluster. If `forward-when-no-consumers` is false, then -messages won't be forwarded to nodes which don't have matching -consumers, this is great and ensures that messages don't arrive on a -queue which has no consumers to consume them, however there is a +across the cluster. If `message-load-balancing` is `OFF` or `ON_DEMAND` +then messages won't be forwarded to nodes which don't have matching +consumers. This is great and ensures that messages aren't moved to a +queue which has no consumers to consume them. However, there is a situation it doesn't solve: What happens if the consumers on a queue close after the messages have been sent to the node? If there are no consumers on the queue the message won't get consumed and we have a @@ -914,7 +920,8 @@ consumers on the queue the message won't get consumed and we have a This is where message redistribution comes in. With message redistribution Apache ActiveMQ Artemis can be configured to automatically *redistribute* messages from queues which have no consumers back to -other nodes in the cluster which do have matching consumers. +other nodes in the cluster which do have matching consumers. To enable +this functionality `message-load-balancing` must be `ON_DEMAND`. Message redistribution can be configured to kick in immediately after the last consumer on a queue is closed, or to wait a configurable delay diff --git a/docs/user-manual/en/configuration-index.md b/docs/user-manual/en/configuration-index.md index 61c01d748d..72b4b372e7 100644 --- a/docs/user-manual/en/configuration-index.md +++ b/docs/user-manual/en/configuration-index.md @@ -163,7 +163,7 @@ Name | Description [max-retry-interval](clusters.md "Clusters") | Maximum value for retry-interval. Default=2000 [reconnect-attempts](clusters.md "Clusters") | How many attempts should be made to reconnect after failure. Default=-1 [use-duplicate-detection](clusters.md "Clusters") | should duplicate detection headers be inserted in forwarded messages?. Default=true -[forward-when-no-consumers](clusters.md "Clusters") | should messages be load balanced if there are no matching consumers on target? Default=false +[message-load-balancing](clusters.md "Clusters") | how should messages be load balanced? Default=OFF [max-hops](clusters.md "Clusters") | maximum number of hops cluster topology is propagated. Default=1 [confirmation-window-size](client-reconnection.md "Client Reconnection and Session Reattachment")| The size (in bytes) of the window used for confirming data from the server connected to. Default 1048576 [producer-window-size](clusters.md "Clusters") | Flow Control for the Cluster connection bridge. Default -1 (disabled) diff --git a/examples/jms/clustered-durable-subscription/readme.html b/examples/jms/clustered-durable-subscription/readme.html index cd5dcce835..440d281653 100644 --- a/examples/jms/clustered-durable-subscription/readme.html +++ b/examples/jms/clustered-durable-subscription/readme.html @@ -33,32 +33,32 @@ under the License. on different nodes of the cluster, and consume from them simultaneously. This allows the work of processing messages from a durable subscription to be spread across the cluster in a similar way to how JMS Queues can be load balanced across the cluster -

-

In this example we first configure the two nodes to form a cluster, then we then create a durable subscriber +

+

In this example we first configure the two nodes to form a cluster, then we then create a durable subscriber with the same name and client-id on both nodes, and we create a producer on only one of the nodes.

We then send some messages via the producer, and we verify that the messages are round robin'd between - the two subscription instances. Note that each durable subscription instance with the same name and client-id + the two subscription instances. Note that each durable subscription instance with the same name and client-id does not receive its own copy of the messages. This is because the instances on different nodes form a single "logical" durable subscription, in the same way multiple JMS Queue instances on different nodes - form a single "local" JMS Queue

+ form a single "local" JMS Queue

This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use - JNDI, these could be instantiated directly. + JNDI, these could be instantiated directly.

Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes - and to load balance the messages between the nodes.

+ and to load balance the messages between the nodes.

      <cluster-connection name="my-cluster">
         <address>jms</address>
         <retry-interval>500</retry-interval>
         <use-duplicate-detection>true</use-duplicate-detection>
-        <forward-when-no-consumers>true</forward-when-no-consumers>
+        <message-load-balancing>STRICT</message-load-balancing>
         <max-hops>1</max-hops>
         <discovery-group-ref discovery-group-name="my-discovery-group"/>
      </cluster-connection>
      
-     
+

For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering - section of the user manual.

- + section of the user manual.

+

Example step-by-step

To run the example, simply type mvn verify -Pexample from this directory

@@ -96,11 +96,11 @@ under the License.
           
    connection0 = cf0.createConnection();
-   final String clientID = "my-client-id";         
+   final String clientID = "my-client-id";
    connection0.setClientID(clientID);
           
         
- +
  • We create a JMS Connection connection1 which is a connection to server 1 and set the same client-id.
  • @@ -116,7 +116,7 @@ under the License.
        Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
                
             
    - +
  • We create a JMS Session on server 1
  •             
    @@ -139,7 +139,7 @@ under the License.
             
                
        final String subscriptionName = "my-subscription";
    -         
    +
        MessageConsumer subscriber0 = session0.createDurableSubscriber(topic, subscriptionName);
     
        MessageConsumer subscriber1 = session1.createDurableSubscriber(topic, subscriptionName);
    @@ -160,14 +160,14 @@ under the License.
     	for (int i = 0; i < numMessages; i++)
     	{
     	   TextMessage message = session0.createTextMessage("This is text message " + i);
    -	      
    +
     	   producer.send(message);
    -	
    +
     	   System.out.println("Sent message: " + message.getText());
     	}
                
             
    - +
  • We now consume those messages on *both* server 0 and server 1. Note that the messages have been load-balanced between the two nodes, with some @@ -179,15 +179,15 @@ under the License. for (int i = 0; i < numMessages; i += 2) { TextMessage message0 = (TextMessage)consumer0.receive(5000); - + System.out.println("Got message: " + message0.getText() + " from node 0"); - + TextMessage message1 = (TextMessage)consumer1.receive(5000); - + System.out.println("Got message: " + message1.getText() + " from node 1"); } -
  • +
  • And finally (no pun intended), always remember to close your JMS resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
  • @@ -199,7 +199,7 @@ under the License. { connection0.close(); } - + if (connection1 != null) { connection1.close(); diff --git a/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/broker.xml index e32c8cbd38..f9b0e67d0a 100644 --- a/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml index b863f560d3..64f6d68e26 100644 --- a/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-durable-subscription/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-grouping/readme.html b/examples/jms/clustered-grouping/readme.html index 91aba99224..1f5010cf13 100644 --- a/examples/jms/clustered-grouping/readme.html +++ b/examples/jms/clustered-grouping/readme.html @@ -39,7 +39,7 @@ under the License. <connector-ref>netty-connector</connector-ref> <retry-interval>500</retry-interval> <use-duplicate-detection>true</use-duplicate-detection> - <forward-when-no-consumers>true</forward-when-no-consumers> + <message-load-balancing>STRICT</message-load-balancing> <max-hops>1</max-hops> <discovery-group-ref discovery-group-name="my-discovery-group"/> </cluster-connection> @@ -61,7 +61,7 @@ under the License. <address>jms</address> <retry-interval>500</retry-interval> <use-duplicate-detection>true</use-duplicate-detection> - <forward-when-no-consumers>true</forward-when-no-consumers> + <message-load-balancing>STRICT</message-load-balancing> <max-hops>1</max-hops> <discovery-group-ref discovery-group-name="my-discovery-group"/> </cluster-connection> @@ -74,9 +74,9 @@ under the License. </grouping-handler> - +

    For more information on ActiveMQ Artemis clustering and grouping see the clustering and grouping - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml index 8c14b205c7..eb20ac8ae9 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server0/broker.xml @@ -73,7 +73,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml index 06fefc6d6c..c544203be3 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml index 7ad49e4737..d9f0c6e5f5 100644 --- a/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/clustered-grouping/src/main/resources/activemq/server2/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/broker.xml index 3edefd06ae..8eb82842eb 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/activemq/server0/broker.xml @@ -74,7 +74,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/broker.xml index aacaecb57a..b72e119ff2 100644 --- a/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-jgroups/src/main/resources/activemq/server1/broker.xml @@ -73,7 +73,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-queue/readme.html b/examples/jms/clustered-queue/readme.html index be08324ac0..60ebd89d75 100644 --- a/examples/jms/clustered-queue/readme.html +++ b/examples/jms/clustered-queue/readme.html @@ -33,23 +33,23 @@ under the License. in a round-robin fashion.

    In other words, ActiveMQ Artemis load balances the sent messages across all consumers on the cluster

    This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use - JNDI, these could be instantiated directly.

    + JNDI, these could be instantiated directly.

    Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes - and to load balance the messages between the nodes.

    + and to load balance the messages between the nodes.

          <cluster-connection name="my-cluster">
             <address>jms</address>
             <connector-ref>netty-connector</connector-ref>
             <retry-interval>500</retry-interval>
             <use-duplicate-detection>true</use-duplicate-detection>
    -        <forward-when-no-consumers>true</forward-when-no-consumers>
    +        <message-load-balancing>STRICT</message-load-balancing>
             <max-hops>1</max-hops>
             <discovery-group-ref discovery-group-name="my-discovery-group"/>
          </cluster-connection>
          
    -     
    +

    For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    @@ -88,7 +88,7 @@ under the License. connection0 = cf0.createConnection(); - +
  • We create a JMS Connection connection1 which is a connection to server 1
  •            
    @@ -102,7 +102,7 @@ under the License.
        Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
                
             
    - +
  • We create a JMS Session on server 1
  •             
    @@ -142,14 +142,14 @@ under the License.
     	for (int i = 0; i < numMessages; i++)
     	{
     	   TextMessage message = session0.createTextMessage("This is text message " + i);
    -	      
    +
     	   producer.send(message);
    -	
    +
     	   System.out.println("Sent message: " + message.getText());
     	}
                
             
    - +
  • We now consume those messages on *both* server 0 and server 1. We note the messages have been distributed between servers in a round robin fashion. ActiveMQ Artemis has load balanced the messages between the available consumers on the different nodes. @@ -162,15 +162,15 @@ under the License. for (int i = 0; i < numMessages; i += 2) { TextMessage message0 = (TextMessage)consumer0.receive(5000); - + System.out.println("Got message: " + message0.getText() + " from node 0"); - + TextMessage message1 = (TextMessage)consumer1.receive(5000); - + System.out.println("Got message: " + message1.getText() + " from node 1"); } - +
  • And finally (no pun intended), always remember to close your JMS resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
  • @@ -182,7 +182,7 @@ under the License. { connection0.close(); } - + if (connection1 != null) { connection1.close(); diff --git a/examples/jms/clustered-queue/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-queue/src/main/resources/activemq/server0/broker.xml index ebdbd530dc..f038cfe2d9 100644 --- a/examples/jms/clustered-queue/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-queue/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-queue/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-queue/src/main/resources/activemq/server1/broker.xml index 7e6426dcca..531fed154c 100644 --- a/examples/jms/clustered-queue/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-queue/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-standalone/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-standalone/src/main/resources/activemq/server0/broker.xml index f9db9bc634..16f500258c 100644 --- a/examples/jms/clustered-standalone/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-standalone/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-standalone/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-standalone/src/main/resources/activemq/server1/broker.xml index 6cb750ec7e..33f9cf4f8d 100644 --- a/examples/jms/clustered-standalone/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-standalone/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-standalone/src/main/resources/activemq/server2/broker.xml b/examples/jms/clustered-standalone/src/main/resources/activemq/server2/broker.xml index 6ea8a26bf3..3275f283a6 100644 --- a/examples/jms/clustered-standalone/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/clustered-standalone/src/main/resources/activemq/server2/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-static-discovery/readme.html b/examples/jms/clustered-static-discovery/readme.html index 863557a5e3..71a4501d46 100644 --- a/examples/jms/clustered-static-discovery/readme.html +++ b/examples/jms/clustered-static-discovery/readme.html @@ -34,25 +34,25 @@ under the License. in a round-robin fashion.

    In other words, ActiveMQ Artemis load balances the sent messages across all consumers on the cluster

    This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use - JNDI, these could be instantiated directly.

    + JNDI, these could be instantiated directly.

    Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes - and to load balance the messages between the nodes.

    + and to load balance the messages between the nodes.

          <cluster-connection name="my-cluster">
             <address>jms</address>
             <connector-ref>netty-connector</connector-ref>
             <retry-interval>500</retry-interval>
             <use-duplicate-detection>true</use-duplicate-detection>
    -        <forward-when-no-consumers>true</forward-when-no-consumers>
    +        <message-load-balancing>STRICT</message-load-balancing>
             <max-hops>1</max-hops>
             <static-connectors>
                <connector-ref>server1-connector</connector-ref>
             </static-connectors>
          </cluster-connection>
          
    -     
    +

    For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    @@ -91,7 +91,7 @@ under the License. connection0 = cf0.createConnection(); - +
  • We create a JMS Connection connection1 which is a connection to server 1
  •            
    @@ -105,7 +105,7 @@ under the License.
        Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
                
             
    - +
  • We create a JMS Session on server 1
  •             
    @@ -145,14 +145,14 @@ under the License.
     	for (int i = 0; i < numMessages; i++)
     	{
     	   TextMessage message = session0.createTextMessage("This is text message " + i);
    -	      
    +
     	   producer.send(message);
    -	
    +
     	   System.out.println("Sent message: " + message.getText());
     	}
                
             
    - +
  • We now consume those messages on *both* server 0 and server 1. We note the messages have been distributed between servers in a round robin fashion. ActiveMQ Artemis has load balanced the messages between the available consumers on the different nodes. @@ -165,15 +165,15 @@ under the License. for (int i = 0; i < numMessages; i += 2) { TextMessage message0 = (TextMessage)consumer0.receive(5000); - + System.out.println("Got message: " + message0.getText() + " from node 0"); - + TextMessage message1 = (TextMessage)consumer1.receive(5000); - + System.out.println("Got message: " + message1.getText() + " from node 1"); } - +
  • And finally (no pun intended), always remember to close your JMS resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
  • @@ -185,7 +185,7 @@ under the License. { connection0.close(); } - + if (connection1 != null) { connection1.close(); diff --git a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml index a655fa1711..e751729637 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server0/broker.xml @@ -57,7 +57,7 @@ under the License. netty-connector 500 true - true + STRICT 1 server1-connector diff --git a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml index 7925ff9dba..8e48890608 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server1/broker.xml @@ -57,7 +57,7 @@ under the License. netty-connector 500 true - true + STRICT 1 server0-connector diff --git a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml index 0888816709..9321799dda 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server2/broker.xml @@ -54,7 +54,7 @@ netty-connector 500 true - true + STRICT 1 server0-connector diff --git a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml index 60fb6cef63..c8879a41b2 100644 --- a/examples/jms/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml +++ b/examples/jms/clustered-static-discovery/src/main/resources/activemq/server3/broker.xml @@ -54,7 +54,7 @@ netty-connector 500 true - true + STRICT 1 server0-connector diff --git a/examples/jms/clustered-static-oneway/readme.html b/examples/jms/clustered-static-oneway/readme.html index 09414926ab..4aacbbdbd3 100644 --- a/examples/jms/clustered-static-oneway/readme.html +++ b/examples/jms/clustered-static-oneway/readme.html @@ -36,7 +36,7 @@ under the License. in a round-robin fashion.

    In other words, ActiveMQ Artemis load balances the sent messages across all consumers on the cluster

    This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use - JNDI, these could be instantiated directly.

    + JNDI, these could be instantiated directly.

    Here's the relevant snippet from the server configuration, which tells the server to form a one way cluster between the three nodes and to load balance the messages between the nodes. Note that we have set allow-direct-connections-only to true, this means that this server will only ever connect the address's specified in the list of connectors. ALso notice @@ -49,16 +49,16 @@ under the License. <connector-ref>netty-connector</connector-ref> <retry-interval>500</retry-interval> <use-duplicate-detection>true</use-duplicate-detection> - <forward-when-no-consumers>true</forward-when-no-consumers> + <message-load-balancing>STRICT</message-load-balancing> <max-hops>2</max-hops> <static-connectors allow-direct-connections-only="true"> <connector-ref>server1-connector</connector-ref> </static-connectors> </cluster-connection> - +

    For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    @@ -120,7 +120,7 @@ under the License. Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE); - +
  • We create a JMS Session on server 1
  •             
    @@ -175,14 +175,14 @@ under the License.
     	for (int i = 0; i < numMessages; i++)
     	{
     	   TextMessage message = session0.createTextMessage("This is text message " + i);
    -	      
    +
     	   producer.send(message);
    -	
    +
     	   System.out.println("Sent message: " + message.getText());
     	}
                
             
    - +
  • We now consume those messages on *both* server 0 and server 1. We note the messages have been distributed between servers in a round robin fashion. ActiveMQ Artemis has load balanced the messages between the available consumers on the different nodes. @@ -195,11 +195,11 @@ under the License. for (int i = 0; i < numMessages; i += 2) { TextMessage message0 = (TextMessage)consumer0.receive(5000); - + System.out.println("Got message: " + message0.getText() + " from node 0"); - + TextMessage message1 = (TextMessage)consumer1.receive(5000); - + System.out.println("Got message: " + message1.getText() + " from node 1"); TextMessage message2 = (TextMessage)consumer2.receive(5000); @@ -207,7 +207,7 @@ under the License. System.out.println("Got message: " + message2.getText() + " from node " + con2Node); } - +
  • And finally (no pun intended), always remember to close your JMS resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
  • diff --git a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml index 4da5fa916c..cace0be89e 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server0/broker.xml @@ -54,7 +54,7 @@ netty-connector 500 true - true + STRICT 2 server1-connector diff --git a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml index f8662cfe6d..d6918f6468 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server1/broker.xml @@ -54,7 +54,7 @@ netty-connector 500 true - true + STRICT 2 server2-connector diff --git a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml index a3a8a47566..9f2e15aa30 100644 --- a/examples/jms/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml +++ b/examples/jms/clustered-static-oneway/src/main/resources/activemq/server2/broker.xml @@ -52,7 +52,7 @@ netty-connector 500 true - true + STRICT 2 diff --git a/examples/jms/clustered-topic/readme.html b/examples/jms/clustered-topic/readme.html index 087fafccf2..bf92e08db8 100644 --- a/examples/jms/clustered-topic/readme.html +++ b/examples/jms/clustered-topic/readme.html @@ -34,22 +34,22 @@ under the License.

    A JMS Topic is an example of publish-subscribe messaging where all subscribers receive all the messages sent to the topic (assuming they have no message selectors).

    This example uses JNDI to lookup the JMS Queue and ConnectionFactory objects. If you prefer not to use - JNDI, these could be instantiated directly. + JNDI, these could be instantiated directly.

    Here's the relevant snippet from the server configuration, which tells the server to form a cluster between the two nodes - and to load balance the messages between the nodes.

    + and to load balance the messages between the nodes.

          <cluster-connection name="my-cluster">
             <address>jms</address>
             <retry-interval>500</retry-interval>
             <use-duplicate-detection>true</use-duplicate-detection>
    -        <forward-when-no-consumers>true</forward-when-no-consumers>
    +        <message-load-balancing>STRICT</message-load-balancing>
             <max-hops>1</max-hops>
             <discovery-group-ref discovery-group-name="my-discovery-group"/>
          </cluster-connection>
          
    -     
    +

    For more information on ActiveMQ Artemis load balancing, and clustering in general, please see the clustering - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    @@ -88,7 +88,7 @@ under the License. connection0 = cf0.createConnection(); - +
  • We create a JMS Connection connection1 which is a connection to server 1
  •            
    @@ -102,7 +102,7 @@ under the License.
        Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
                
             
    - +
  • We create a JMS Session on server 1
  •             
    @@ -142,14 +142,14 @@ under the License.
     	for (int i = 0; i < numMessages; i++)
     	{
     	   TextMessage message = session0.createTextMessage("This is text message " + i);
    -	      
    +
     	   producer.send(message);
    -	
    +
     	   System.out.println("Sent message: " + message.getText());
     	}
                
             
    - +
  • We now consume those messages on both server 0 and server 1. We note that all messages have been consumed by both consumers. @@ -159,15 +159,15 @@ under the License. for (int i = 0; i < numMessages; i ++) { TextMessage message0 = (TextMessage)consumer0.receive(5000); - + System.out.println("Got message: " + message0.getText() + " from node 0"); - + TextMessage message1 = (TextMessage)consumer1.receive(5000); - + System.out.println("Got message: " + message1.getText() + " from node 1"); } - +
  • And finally (no pun intended), always remember to close your JMS resources after use, in a finally block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objects
  • @@ -179,7 +179,7 @@ under the License. { connection0.close(); } - + if (connection1 != null) { connection1.close(); diff --git a/examples/jms/clustered-topic/src/main/resources/activemq/server0/broker.xml b/examples/jms/clustered-topic/src/main/resources/activemq/server0/broker.xml index 4856aa828f..604bcf8169 100644 --- a/examples/jms/clustered-topic/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/clustered-topic/src/main/resources/activemq/server0/broker.xml @@ -74,7 +74,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/clustered-topic/src/main/resources/activemq/server1/broker.xml b/examples/jms/clustered-topic/src/main/resources/activemq/server1/broker.xml index a9d16a8c7f..1f5f25da26 100644 --- a/examples/jms/clustered-topic/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/clustered-topic/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml index c9dec4ce4c..9d6d063e57 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server0/broker.xml @@ -76,7 +76,7 @@ under the License. 5 true - true + STRICT 1 diff --git a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml index 20ceb15731..cda407e7f6 100644 --- a/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/colocated-failover-scale-down/src/main/resources/activemq/server1/broker.xml @@ -76,7 +76,7 @@ under the License. 5 true - true + STRICT 1 diff --git a/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml b/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml index 5b3221d7c7..363ae96e34 100644 --- a/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/colocated-failover/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml b/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml index 84f38f1302..464fdee086 100644 --- a/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/colocated-failover/src/main/resources/activemq/server1/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - true + STRICT 1 diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml index 8c38aead9b..79dd692a27 100644 --- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server0/broker.xml @@ -81,7 +81,7 @@ under the License. netty-connector 500 true - true + STRICT 1 server1-connector diff --git a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml index ca0f81157e..7b135ac8e9 100644 --- a/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/ha-policy-autobackup/src/main/resources/activemq/server1/broker.xml @@ -81,7 +81,7 @@ under the License. netty-connector 500 true - true + STRICT 1 server0-connector diff --git a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml index e745c71664..2d771b0b5c 100644 --- a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server0/broker.xml @@ -72,7 +72,7 @@ under the License. netty-connector 500 true - false + ON_DEMAND 1 diff --git a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml index 7bb693f601..870be491db 100644 --- a/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/queue-message-redistribution/src/main/resources/activemq/server1/broker.xml @@ -73,7 +73,7 @@ under the License. netty-connector 500 true - false + ON_DEMAND 1 diff --git a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml index 4a38a74593..33de64fe87 100644 --- a/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml +++ b/examples/jms/scale-down/src/main/resources/activemq/server0/broker.xml @@ -73,7 +73,7 @@ under the License. 500 5 true - true + STRICT 1 diff --git a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml index 57fa72d848..7602ef9529 100644 --- a/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml +++ b/examples/jms/scale-down/src/main/resources/activemq/server1/broker.xml @@ -74,7 +74,7 @@ under the License. 500 5 true - true + STRICT 1 diff --git a/examples/jms/symmetric-cluster/readme.html b/examples/jms/symmetric-cluster/readme.html index 116735c541..8be9587f7d 100644 --- a/examples/jms/symmetric-cluster/readme.html +++ b/examples/jms/symmetric-cluster/readme.html @@ -46,7 +46,7 @@ under the License.

    Using UDP discovery makes configuration simpler since we don't have to know what nodes are available at any one time.

    Here's the relevant snippet from the server configuration, which tells the server to form a cluster - with the other nodes:

    + with the other nodes:

          
        <cluster-connection name="my-cluster">
    @@ -54,19 +54,19 @@ under the License.
           <connector-ref>netty-connector</connector-ref>
     	   <retry-interval>500</retry-interval>
     	   <use-duplicate-detection>true</use-duplicate-detection>
    -	   <forward-when-no-consumers>true</forward-when-no-consumers>
    +	   <message-load-balancing>STRICT</message-load-balancing>
     	   <max-hops>1</max-hops>
     	   <discovery-group-ref discovery-group-name="my-discovery-group"/>
        </cluster-connection>
        
    -     
    +

    In this example we create a symmetric cluster of six live nodes, and we also pair each live node with it's own backup node. (A backup node is not strictly necessary for a symmetric cluster).

    In this example will we will demonstrate this by deploying a JMS topic and Queue on all nodes of the cluster , sending messages to the queue and topic from different nodes, and verifying messages are received correctly by consumers on different nodes.

    For more information on configuring ActiveMQ Artemis clustering in general, please see the clustering - section of the user manual.

    + section of the user manual.

    Example step-by-step

    To run the example, simply type mvn verify -Pexample from this directory

    @@ -77,12 +77,12 @@ under the License. specific server to do that, and that server might not be available at the time. By creating the connection factory directly we avoid having to worry about a JNDI look-up. In an app server environment you could use HA-JNDI to lookup from the clustered JNDI servers without - having to know about a specific one. + having to know about a specific one. - +
                
    -   ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithHA("231.7.7.7", 9876); 
    +   ConnectionFactory cf = ActiveMQJMSClient.createConnectionFactoryWithHA("231.7.7.7", 9876);
        
             
    @@ -90,8 +90,8 @@ under the License.
                
        Queue queue = new ActiveMQQueue("exampleQueue");
    -         
    -   Topic topic = ActiveMQJMSClient.createActiveMQTopic("exampleTopic");           
    +
    +   Topic topic = ActiveMQJMSClient.createActiveMQTopic("exampleTopic");
                
             
    @@ -165,7 +165,7 @@ under the License. MessageConsumer consumer0 = session0.createConsumer(queue); - +
  • We create an anonymous message producer on server 2.
  •            
    @@ -177,15 +177,15 @@ under the License.
             
                
        final int numMessages = 500;
    -                  
    +
        for (int i = 0; i < numMessages; i++)
        {
           TextMessage message1 = session2.createTextMessage("Topic message 1");
    -   
    +
           producer2.send(topic, message1);
    -      
    +
           TextMessage message2 = session2.createTextMessage("Queue message 1");
    -      
    +
           producer2.send(queue, message2);
        }
                
    @@ -262,7 +262,7 @@ under the License.
           {
              connection1.close();
           }
    -      
    +
           if (connection2 != null)
           {
              connection2.close();
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
    index 312d7a2b41..27b74894a9 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server0/broker.xml
    @@ -76,7 +76,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
    index f7c2569a7a..16a7931959 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server1/broker.xml
    @@ -74,7 +74,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
    index b87a19e7ac..30f33a0ae5 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server2/broker.xml
    @@ -74,7 +74,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
    index 03748768e1..afda21b6ca 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server3/broker.xml
    @@ -74,7 +74,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
    index 25b099c97c..321d57bb6f 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server4/broker.xml
    @@ -73,7 +73,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
    index 8efb4aa83a..abbe9adfdc 100644
    --- a/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
    +++ b/examples/jms/symmetric-cluster/src/main/resources/activemq/server5/broker.xml
    @@ -73,7 +73,7 @@ under the License.
                 netty-connector
                 500
                 true
    -            false
    +            ON_DEMAND
                 1
                 
              
    diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
    index 0572255333..732c5ed50d 100644
    --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
    +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ClusteredGroupingTest.java
    @@ -22,6 +22,7 @@ import org.apache.activemq.artemis.api.core.SimpleString;
     import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
     import org.apache.activemq.artemis.api.core.management.ManagementHelper;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
     import org.apache.activemq.artemis.core.server.group.impl.Response;
     import org.apache.activemq.artemis.core.server.management.Notification;
    @@ -66,9 +67,9 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(0, isFileStorage(), isNetty());
           setupServer(1, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, 0, 500, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 0, 1);
     
    -      setupClusterConnection("cluster1", "queues", false, 1,  0, 500, isNetty(), 1, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 1, 0);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -141,11 +142,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1,  0, 500, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1,  0, 500, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1,  0, 500, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -226,11 +227,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1,  0, 500, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1,  0, 500, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1,  0, 500, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -312,13 +313,13 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(2, isFileStorage(), isNetty());
           setupServer(3, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1,  0, 500, isNetty(), 0, 1, 2, 3);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 0, 1, 2, 3);
     
    -      setupClusterConnection("cluster1", "queues", false, 1,  0, 500, isNetty(), 1, 0, 2, 3);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 1, 0, 2, 3);
     
    -      setupClusterConnection("cluster2", "queues", false, 1,  0, 500, isNetty(), 2, 0, 1, 3);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 2, 0, 1, 3);
     
    -      setupClusterConnection("cluster3", "queues", false, 1,  0, 500, isNetty(), 3, 1, 2, 3);
    +      setupClusterConnection("cluster3", "queues", MessageLoadBalancingType.ON_DEMAND, 1,  0, 500, isNetty(), 3, 1, 2, 3);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
    index bf98b4b687..5358baef37 100644
    --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
    +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailoverTest.java
    @@ -22,6 +22,7 @@ import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
     import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
     import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.jboss.byteman.contrib.bmunit.BMRule;
     import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
    @@ -60,9 +61,9 @@ public class ScaleDownFailoverTest extends ClusterTestBase
              scaleDownConfiguration3.setGroupName("bill");
           }
           staticServers = servers;
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
           scaleDownConfiguration.getConnectors().addAll(servers[0].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
           scaleDownConfiguration2.getConnectors().addAll(servers[1].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
           scaleDownConfiguration3.getConnectors().addAll(servers[2].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
    diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
    index 46ea3b170d..5c64aa5947 100644
    --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
    +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ScaleDownFailureTest.java
    @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.extras.byteman;
     import org.apache.activemq.artemis.api.core.client.ClientMessage;
     import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
     import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.jboss.byteman.contrib.bmunit.BMRule;
     import org.jboss.byteman.contrib.bmunit.BMUnitRunner;
    @@ -44,8 +45,8 @@ public class ScaleDownFailureTest extends ClusterTestBase
              ((LiveOnlyPolicyConfiguration) servers[0].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration);
              ((LiveOnlyPolicyConfiguration) servers[1].getConfiguration().getHAPolicyConfiguration()).setScaleDownConfiguration(scaleDownConfiguration);
           }
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
           startServers(0, 1);
           setupSessionFactory(0, isNetty());
           setupSessionFactory(1, isNetty());
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java
    index 84541e6d01..cf352fdd08 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ClusterControllerTest.java
    @@ -22,6 +22,7 @@ import org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl;
     import org.apache.activemq.artemis.core.server.cluster.ActiveMQServerSideProtocolManagerFactory;
     import org.apache.activemq.artemis.core.server.cluster.ClusterControl;
     import org.apache.activemq.artemis.core.server.cluster.ClusterController;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.junit.Before;
     import org.junit.Test;
    @@ -48,8 +49,8 @@ public class ClusterControllerTest extends ClusterTestBase
     
           getServer(1).getConfiguration().setClusterPassword("something different");
     
    -      setupClusterConnection("cluster0", "queues", false, 1, true, 0);
    -      setupClusterConnection("cluster0", "queues", false, 1, true, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, true, 0);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, true, 1);
     
           startServers(0);
           startServers(1);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
    index c89ac1b1f5..421a2fb3ce 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterHeadersRemovedTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     
     import org.junit.Test;
    @@ -46,8 +47,8 @@ public class ClusterHeadersRemovedTest extends ClusterTestBase
        @Test
        public void testHeadersRemoved() throws Exception
        {
    -      setupClusterConnection("cluster1", 0, 1, "queues", false, 1, isNetty(), false);
    -      setupClusterConnection("clusterX", 1, -1, "queues", false, 1, isNetty(), false);
    +      setupClusterConnection("cluster1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), false);
    +      setupClusterConnection("clusterX", 1, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), false);
           startServers(1, 0);
     
           setupSessionFactory(0, isNetty());
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
    index 9b4017be08..371dee40c3 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java
    @@ -57,6 +57,7 @@ import org.apache.activemq.artemis.core.server.cluster.ClusterConnection;
     import org.apache.activemq.artemis.core.server.cluster.ClusterManager;
     import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding;
     import org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.server.cluster.qourum.SharedNothingBackupQuorum;
     import org.apache.activemq.artemis.core.server.group.GroupingHandler;
     import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
    @@ -1913,7 +1914,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
                                              final int nodeFrom,
                                              final int nodeTo,
                                              final String address,
    -                                         final boolean forwardWhenNoConsumers,
    +                                         final MessageLoadBalancingType messageLoadBalancingType,
                                              final int maxHops,
                                              final boolean netty,
                                              final boolean allowDirectConnectionsOnly)
    @@ -1944,7 +1945,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setAddress(address)
              .setConnectorName(name)
              .setRetryInterval(100)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setStaticConnectors(pairs)
    @@ -1957,7 +1958,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
                                              final int nodeFrom,
                                              final int nodeTo,
                                              final String address,
    -                                         final boolean forwardWhenNoConsumers,
    +                                         final MessageLoadBalancingType messageLoadBalancingType,
                                              final int maxHops,
                                              final int reconnectAttempts,
                                              final long retryInterval,
    @@ -1991,7 +1992,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setConnectorName(name)
              .setReconnectAttempts(reconnectAttempts)
              .setRetryInterval(retryInterval)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setStaticConnectors(pairs)
    @@ -2002,7 +2003,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
     
        protected void setupClusterConnection(final String name,
                                              final String address,
    -                                         final boolean forwardWhenNoConsumers,
    +                                         final MessageLoadBalancingType messageLoadBalancingType,
                                              final int maxHops,
                                              final boolean netty,
                                              final int nodeFrom,
    @@ -2027,7 +2028,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
           }
           Configuration config = serverFrom.getConfiguration();
           ClusterConnectionConfiguration clusterConf =
    -         createClusterConfig(name, address, forwardWhenNoConsumers,
    +         createClusterConfig(name, address, messageLoadBalancingType,
                                  maxHops,
                                  connectorFrom,
                                  pairs);
    @@ -2037,7 +2038,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
     
        protected void setupClusterConnection(final String name,
                                              final String address,
    -                                         final boolean forwardWhenNoConsumers,
    +                                         final MessageLoadBalancingType messageLoadBalancingType,
                                              final int maxHops,
                                              final int reconnectAttempts,
                                              final long retryInterval,
    @@ -2072,7 +2073,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setReconnectAttempts(reconnectAttempts)
              .setCallTimeout(100)
              .setCallFailoverTimeout(100)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setStaticConnectors(pairs);
    @@ -2081,7 +2082,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
        }
     
        private ClusterConnectionConfiguration createClusterConfig(final String name, final String address,
    -                                                              final boolean forwardWhenNoConsumers, final int maxHops,
    +                                                              final MessageLoadBalancingType messageLoadBalancingType, final int maxHops,
                                                                   TransportConfiguration connectorFrom, List pairs)
        {
           return new ClusterConnectionConfiguration()
    @@ -2089,7 +2090,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setAddress(address)
              .setConnectorName(connectorFrom.getName())
              .setRetryInterval(250)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setStaticConnectors(pairs);
    @@ -2097,7 +2098,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
     
        protected void setupClusterConnectionWithBackups(final String name,
                                                         final String address,
    -                                                    final boolean forwardWhenNoConsumers,
    +                                                    final MessageLoadBalancingType messageLoadBalancingType,
                                                         final int maxHops,
                                                         final boolean netty,
                                                         final int nodeFrom,
    @@ -2127,7 +2128,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setAddress(address)
              .setConnectorName(name)
              .setRetryInterval(250)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setStaticConnectors(pairs);
    @@ -2139,7 +2140,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
                                                       final int node,
                                                       final String discoveryGroupName,
                                                       final String address,
    -                                                  final boolean forwardWhenNoConsumers,
    +                                                  final MessageLoadBalancingType messageLoadBalancingType,
                                                       final int maxHops,
                                                       final boolean netty)
        {
    @@ -2159,7 +2160,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase
              .setConnectorName(name)
              .setRetryInterval(100)
              .setDuplicateDetection(true)
    -         .setForwardWhenNoConsumers(forwardWhenNoConsumers)
    +         .setMessageLoadBalancingType(messageLoadBalancingType)
              .setMaxHops(maxHops)
              .setConfirmationWindowSize(1024)
              .setDiscoveryGroupName(discoveryGroupName);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterWithBackupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterWithBackupTest.java
    index 474a953466..0e5c2a1a25 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterWithBackupTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterWithBackupTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.junit.Before;
     
    @@ -83,22 +84,22 @@ public class ClusterWithBackupTest extends ClusterTestBase
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 3, 4, 5);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 3, 4, 5);
     
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 3, 5);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 4, 3, 5);
     
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 5, 3, 4);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 5, 3, 4);
     
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 4, 5);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 4, 5);
     
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 3, 5);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 3, 5);
     
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 3, 4);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 2, 3, 4);
        }
     
        protected void setupServers() throws Exception
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
    index 9efcae4a3a..d4446a8190 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java
    @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.core.client.ClientSession;
     import org.apache.activemq.artemis.api.core.client.ClientSessionFactory;
     import org.apache.activemq.artemis.api.core.management.CoreNotificationType;
     import org.apache.activemq.artemis.core.postoffice.impl.BindingsImpl;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.server.group.GroupingHandler;
     import org.apache.activemq.artemis.core.server.group.UnproposalListener;
     import org.apache.activemq.artemis.core.server.group.impl.GroupBinding;
    @@ -59,11 +60,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, 2000, 1000, 100);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1, 2000, 1000, 100);
    @@ -168,11 +169,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, -1, 2000, 500);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -261,11 +262,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -308,11 +309,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           final int TIMEOUT_GROUPS = 5000;
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, TIMEOUT_GROUPS, -1, -1);
    @@ -424,11 +425,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, 1000, 1000, 100);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1, 1000, 100, 100);
    @@ -515,9 +516,9 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, 10000, 500, 750);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1, 10000, 500, 750);
    @@ -823,11 +824,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           int TIMEOUT = 50000;
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0, TIMEOUT);
    @@ -904,11 +905,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -983,11 +984,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1, 0);
     
    @@ -1140,11 +1141,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1187,11 +1188,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1238,11 +1239,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1285,11 +1286,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1335,11 +1336,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1381,11 +1382,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1451,11 +1452,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, 0, 500, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, 0, 500, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, 0, 500, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1514,11 +1515,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, 0, 500, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, 0, 500, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, 0, 500, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1577,11 +1578,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, 0, 500, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, 0, 500, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, 0, 500, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 0, 500, isNetty(), 2, 0, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
    @@ -1635,11 +1636,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 2);
    @@ -1686,11 +1687,11 @@ public class ClusteredGroupingTest extends ClusterTestBase
           setupServer(1, isFileStorage(), isNetty());
           setupServer(2, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 1);
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.REMOTE, 2);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
    index d6512f4891..9dc4123165 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredRequestResponseTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     import org.junit.Test;
     
    @@ -129,20 +130,20 @@ public class ClusteredRequestResponseTest extends ClusterTestBase
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2, 3, 4);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1, 2, 3, 4);
     
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0, 2, 3, 4);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0, 2, 3, 4);
     
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 0, 1, 3, 4);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 2, 0, 1, 3, 4);
     
    -      setupClusterConnection("cluster3", "queues", forwardWhenNoConsumers, 1, isNetty(), 3, 0, 1, 2, 4);
    +      setupClusterConnection("cluster3", "queues", messageLoadBalancingType, 1, isNetty(), 3, 0, 1, 2, 4);
     
    -      setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
    +      setupClusterConnection("cluster4", "queues", messageLoadBalancingType, 1, isNetty(), 4, 0, 1, 2, 3);
        }
     
        protected void setupServers() throws Exception
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java
    new file mode 100644
    index 0000000000..3cd9e61547
    --- /dev/null
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageLoadBalancingTest.java
    @@ -0,0 +1,128 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements. See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License. You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +
    +import org.apache.activemq.artemis.api.core.client.ClientMessage;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
    +import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
    +import org.junit.Assert;
    +import org.junit.Before;
    +import org.junit.Test;
    +
    +public class MessageLoadBalancingTest extends ClusterTestBase
    +{
    +   @Override
    +   @Before
    +   public void setUp() throws Exception
    +   {
    +      super.setUp();
    +
    +      start();
    +   }
    +
    +   private void start() throws Exception
    +   {
    +      setupServers();
    +
    +      setRedistributionDelay(0);
    +   }
    +
    +   protected boolean isNetty()
    +   {
    +      return false;
    +   }
    +
    +   @Test
    +   public void testMessageLoadBalancingOff() throws Exception
    +   {
    +      setupCluster(MessageLoadBalancingType.OFF);
    +
    +      startServers(0, 1);
    +
    +      setupSessionFactory(0, isNetty());
    +      setupSessionFactory(1, isNetty());
    +
    +      createQueue(0, "queues.testaddress", "queue0", null, false);
    +      createQueue(1, "queues.testaddress", "queue0", null, false);
    +
    +      addConsumer(1, 1, "queue0", null);
    +
    +      waitForBindings(0, "queues.testaddress", 1, 0, true);
    +      waitForBindings(1, "queues.testaddress", 1, 1, true);
    +
    +      waitForBindings(0, "queues.testaddress", 1, 1, false);
    +      waitForBindings(1, "queues.testaddress", 1, 0, false);
    +
    +      addConsumer(0, 0, "queue0", null);
    +
    +      waitForBindings(0, "queues.testaddress", 1, 1, true);
    +      waitForBindings(1, "queues.testaddress", 1, 1, true);
    +
    +      waitForBindings(0, "queues.testaddress", 1, 1, false);
    +      waitForBindings(1, "queues.testaddress", 1, 1, false);
    +
    +      send(0, "queues.testaddress", 10, false, null);
    +
    +      ClientMessage message = getConsumer(1).receive(1000);
    +      Assert.assertNull(message);
    +
    +      for (int i = 0; i < 10; i++)
    +      {
    +         message = getConsumer(0).receive(5000);
    +         Assert.assertNotNull("" + i, message);
    +         message.acknowledge();
    +      }
    +
    +      ClientMessage clientMessage = getConsumer(0).receiveImmediate();
    +      Assert.assertNull(clientMessage);
    +   }
    +
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
    +   {
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1);
    +
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0);
    +   }
    +
    +   protected void setRedistributionDelay(final long delay)
    +   {
    +      AddressSettings as = new AddressSettings().setRedistributionDelay(delay);
    +
    +      getServer(0).getAddressSettingsRepository().addMatch("queues.*", as);
    +      getServer(1).getAddressSettingsRepository().addMatch("queues.*", as);
    +   }
    +
    +   protected void setupServers() throws Exception
    +   {
    +      setupServer(0, isFileStorage(), isNetty());
    +      setupServer(1, isFileStorage(), isNetty());
    +   }
    +
    +   protected void stopServers() throws Exception
    +   {
    +      closeAllConsumers();
    +
    +      closeAllSessionFactories();
    +
    +      closeAllServerLocatorsFactories();
    +
    +      stopServers(0, 1);
    +
    +      clearServer(0, 1);
    +   }
    +
    +}
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
    index ebdac36e03..d294e75f95 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java
    @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.api.core.client.ClientConsumer;
     import org.apache.activemq.artemis.api.core.client.ClientMessage;
     import org.apache.activemq.artemis.api.core.client.ClientProducer;
     import org.apache.activemq.artemis.api.core.client.ClientSession;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.apache.activemq.artemis.core.message.impl.MessageImpl;
     import org.apache.activemq.artemis.core.server.Bindable;
    @@ -69,7 +70,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWithMessageGroups() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           MessageRedistributionTest.log.info("Doing test");
     
    @@ -174,7 +175,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionStopsWhenConsumerAdded() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           MessageRedistributionTest.log.info("Doing test");
     
    @@ -212,7 +213,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenConsumerIsClosed() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           MessageRedistributionTest.log.info("Doing test");
     
    @@ -254,7 +255,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenConsumerIsClosedDifferentQueues() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -334,7 +335,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenConsumerIsClosedNotConsumersOnAllNodes() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -371,7 +372,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        public void testNoRedistributionWhenConsumerIsClosedForwardWhenNoConsumersTrue() throws Exception
        {
           // x
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers(0, 1, 2);
     
    @@ -423,7 +424,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testNoRedistributionWhenConsumerIsClosedNoConsumersOnOtherNodes() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -473,7 +474,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributeWithScheduling() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           AddressSettings setting = new AddressSettings().setRedeliveryDelay(10000);
           servers[0].getAddressSettingsRepository().addMatch("queues.testaddress", setting);
    @@ -583,7 +584,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenConsumerIsClosedQueuesWithFilters() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -624,7 +625,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenConsumerIsClosedConsumersWithFilters() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -665,7 +666,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenRemoteConsumerIsAdded() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -702,7 +703,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        {
           for (int i = 0; i < 10; i++)
           {
    -         setupCluster(false);
    +         setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
              startServers(0, 1, 2);
     
    @@ -812,7 +813,7 @@ public class MessageRedistributionTest extends ClusterTestBase
           }
           for (int i = 0; i < 10; i++)
           {
    -         setupCluster(false);
    +         setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
              startServers(0, 1);
     
    @@ -877,7 +878,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionToQueuesWhereNotAllMessagesMatch() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -919,7 +920,7 @@ public class MessageRedistributionTest extends ClusterTestBase
           final long delay = 1000;
           setRedistributionDelay(delay);
     
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -959,7 +960,7 @@ public class MessageRedistributionTest extends ClusterTestBase
           final long delay = 1000;
           setRedistributionDelay(delay);
     
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -999,7 +1000,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionNumberOfMessagesGreaterThanBatchSize() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0, 1, 2);
     
    @@ -1037,7 +1038,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWhenNewNodeIsAddedWithConsumer() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(0);
     
    @@ -1069,7 +1070,7 @@ public class MessageRedistributionTest extends ClusterTestBase
        @Test
        public void testRedistributionWithPagingOnTarget() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           AddressSettings as = new AddressSettings()
                   .setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)
    @@ -1136,13 +1137,13 @@ public class MessageRedistributionTest extends ClusterTestBase
           session1.close();
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 2, 0, 1);
        }
     
        protected void setRedistributionDelay(final long delay)
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
    index ae6df0c5a7..af15179338 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.junit.Assert;
     import org.junit.Before;
    @@ -53,22 +54,22 @@ public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
           for (int i = 0; i < 5; i++)
           {
    -         setServer(forwardWhenNoConsumers, i);
    +         setServer(messageLoadBalancingType, i);
           }
        }
     
        /**
    -    * @param forwardWhenNoConsumers
    +    * @param messageLoadBalancingType
         * @throws Exception
         */
    -   protected void setServer(final boolean forwardWhenNoConsumers, int server) throws Exception
    +   protected void setServer(final MessageLoadBalancingType messageLoadBalancingType, int server) throws Exception
        {
           setupLiveServerWithDiscovery(server,
                                        groupAddress,
    @@ -83,7 +84,7 @@ public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
     
           servers[server].getAddressSettingsRepository().addMatch("#", setting);
     
    -      setupDiscoveryClusterConnection("cluster" + server, server, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster" + server, server, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
        }
     
        @Test
    @@ -145,7 +146,7 @@ public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase
           servers[0].stop();
           servers[0] = null;
     
    -      setServer(false, 0);
    +      setServer(MessageLoadBalancingType.ON_DEMAND, 0);
     
           startServers(1, 2);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OneWayChainClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OneWayChainClusterTest.java
    index 80b841271e..9d8c5312be 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OneWayChainClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OneWayChainClusterTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     
     import org.junit.Test;
    @@ -52,11 +53,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testBasicRoundRobin() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -83,11 +84,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testBasicNonLoadBalanced() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -117,11 +118,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testRoundRobinForwardWhenNoConsumersTrue() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", true, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", true, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", true, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", true, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.STRICT, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.STRICT, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.STRICT, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.STRICT, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -149,11 +150,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testRoundRobinForwardWhenNoConsumersFalseNoLocalQueue() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -176,11 +177,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testRoundRobinForwardWhenNoConsumersFalse() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -210,11 +211,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testRoundRobinForwardWhenNoConsumersFalseLocalConsumer() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -244,11 +245,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testHopsTooLow() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 3, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 3, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 3, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 3, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 3, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 3, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 3, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 3, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -273,11 +274,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testStartStopMiddleOfChain() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -341,11 +342,11 @@ public class OneWayChainClusterTest extends ClusterTestBase
        @Test
        public void testChainClusterConnections() throws Exception
        {
    -      setupClusterConnection("cluster0-1", 0, 1, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster1-2", 1, 2, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster2-3", 2, 3, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster3-4", 3, 4, "queues", false, 4, isNetty(), true);
    -      setupClusterConnection("cluster4-X", 4, -1, "queues", false, 4, isNetty(), true);
    +      setupClusterConnection("cluster0-1", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster1-2", 1, 2, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster2-3", 2, 3, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster3-4", 3, 4, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
    +      setupClusterConnection("cluster4-X", 4, -1, "queues", MessageLoadBalancingType.ON_DEMAND, 4, isNetty(), true);
     
           startServers(0, 1, 2, 3, 4);
           Set connectionSet = getServer(0).getClusterManager().getClusterConnections();
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
    index b22bbac30d..a98f881df4 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/OnewayTwoNodeClusterTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     
     import org.junit.Test;
    @@ -37,12 +38,12 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
     
           setupServer(0, isFileStorage(), isNetty());
           setupServer(1, isFileStorage(), isNetty());
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
     
        }
     
    -   private void setupCluster(boolean forward)
    +   private void setupCluster(MessageLoadBalancingType messageLoadBalancingType)
        {
           for (ActiveMQServer server : servers)
           {
    @@ -52,9 +53,9 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
              }
           }
           // server #0 is connected to server #1
    -      setupClusterConnection("cluster1", 0, 1, "queues", forward, 1, 0, 500, isNetty(), true);
    +      setupClusterConnection("cluster1", 0, 1, "queues", messageLoadBalancingType, 1, 0, 500, isNetty(), true);
           // server #1 is connected to nobody
    -      setupClusterConnection("clusterX", 1, -1, "queues", forward, 1,  0, 500, isNetty(), true);
    +      setupClusterConnection("clusterX", 1, -1, "queues", messageLoadBalancingType, 1,  0, 500, isNetty(), true);
        }
     
        protected boolean  isNetty()
    @@ -831,7 +832,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersFalseLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
           startServers(1, 0);
     
           setupSessionFactory(0, isNetty(), true);
    @@ -908,7 +909,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersFalseLoadBalancedQueuesNoLocalQueue() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers(1, 0);
     
    @@ -941,7 +942,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersTrueLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
           startServers(1, 0);
     
           setupSessionFactory(0,  isNetty(), true);
    @@ -980,7 +981,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        {
           servers[0].getConfiguration().getClusterConfigurations().clear();
           // server #0 is connected to server #1
    -      setupClusterConnection("cluster1", 0, 1, "queues", true, 1,  isNetty(), true);
    +      setupClusterConnection("cluster1", 0, 1, "queues", MessageLoadBalancingType.STRICT, 1,  isNetty(), true);
     
           startServers(1, 0);
     
    @@ -1020,7 +1021,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        {
           servers[0].getConfiguration().getClusterConfigurations().clear();
           // server #0 is connected to server #1
    -      setupClusterConnection("cluster1", 0, 1, "queues", true, 1,  isNetty(), true);
    +      setupClusterConnection("cluster1", 0, 1, "queues", MessageLoadBalancingType.STRICT, 1,  isNetty(), true);
     
           startServers(1, 0);
     
    @@ -1111,7 +1112,7 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        @Test
        public void testRoundRobinMultipleQueuesWithConsumersWithFilters() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers(1, 0);
     
    @@ -1183,8 +1184,8 @@ public class OnewayTwoNodeClusterTest extends ClusterTestBase
        @Test
        public void testMultipleClusterConnections() throws Exception
        {
    -      setupClusterConnection("cluster2", 0, 1, "q2", false, 1,  isNetty(), true);
    -      setupClusterConnection("cluster3", 0, 1, "q3", false, 1,  isNetty(), true);
    +      setupClusterConnection("cluster2", 0, 1, "q2", MessageLoadBalancingType.ON_DEMAND, 1,  isNetty(), true);
    +      setupClusterConnection("cluster3", 0, 1, "q3", MessageLoadBalancingType.ON_DEMAND, 1,  isNetty(), true);
     
           startServers(1, 0);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
    index d93b673e71..53f99a23c1 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SimpleSymmetricClusterTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.junit.Test;
     
    @@ -52,17 +53,17 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupLiveServer(4, isFileStorage(), true, isNetty(), false);
           setupLiveServer(5, isFileStorage(), true, isNetty(), false);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 3, 4, 5);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 3, 4, 5);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 4, 3, 5);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 4, 3, 5);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 5, 3, 4);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 5, 3, 4);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 4, 5);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 4, 5);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 3, 5);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 3, 5);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 3, 4);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 3, 4);
     
     
           startServers(0, 1, 2, 3, 4, 5);
    @@ -96,9 +97,9 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupServer(1, true, isNetty());
           setupServer(2, true, isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 2, 0);
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 2, 0);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
     
           startServers(0, 1, 2);
     
    @@ -134,8 +135,8 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupServer(0, false, isNetty());
           setupServer(1, false, isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
     
           startServers(0, 1);
     
    @@ -182,15 +183,15 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupServer(3, true, isNetty());
           setupServer(4, true, isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2, 3, 4);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2, 3, 4);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2, 3, 4);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2, 3, 4);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1, 3, 4);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1, 3, 4);
     
    -      setupClusterConnection("cluster3", "queues", false, 1, isNetty(), 3, 0, 1, 2, 4);
    +      setupClusterConnection("cluster3", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 3, 0, 1, 2, 4);
     
    -      setupClusterConnection("cluster4", "queues", false, 1, isNetty(), 4, 0, 1, 2, 3);
    +      setupClusterConnection("cluster4", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 4, 0, 1, 2, 3);
     
           startServers(0, 1, 2, 3, 4);
     
    @@ -235,9 +236,9 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupServer(1, true, isNetty());
           setupServer(2, true, isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, 10, 100, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster1", "queues", false, 1, 10, 100, isNetty(), 1, 2, 0);
    -      setupClusterConnection("cluster1", "queues", false, 1, 10, 100, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 10, 100, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 10, 100, isNetty(), 1, 2, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, 10, 100, isNetty(), 2, 0, 1);
     
           startServers(0, 1, 2);
     
    @@ -311,9 +312,9 @@ public class SimpleSymmetricClusterTest extends ClusterTestBase
           setupServer(1, true, isNetty());
           setupServer(2, true, isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, -1, 1000, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster1", "queues", false, 1, -1, 1000, isNetty(), 1, 2, 0);
    -      setupClusterConnection("cluster1", "queues", false, 1, -1, 1000, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, -1, 1000, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, -1, 1000, isNetty(), 1, 2, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, -1, 1000, isNetty(), 2, 0, 1);
     
           startServers(0, 1, 2);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java
    index 9c749a7cb1..17e8a866f8 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.junit.Before;
    @@ -1021,7 +1022,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersTrueLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers();
     
    @@ -1075,7 +1076,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersFalseLocalConsumerLoadBalancedQueues() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers();
     
    @@ -1130,7 +1131,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersFalseNonLoadBalancedQueues2() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers();
     
    @@ -1184,7 +1185,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersFalseNonLoadBalancedQueues() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
     
           startServers();
     
    @@ -1238,7 +1239,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testRouteWhenNoConsumersTrueNonLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers();
     
    @@ -1292,7 +1293,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testNoLocalQueueNonLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers();
     
    @@ -1331,7 +1332,7 @@ public class SymmetricClusterTest extends ClusterTestBase
        @Test
        public void testNoLocalQueueLoadBalancedQueues() throws Exception
        {
    -      setupCluster(true);
    +      setupCluster(MessageLoadBalancingType.STRICT);
     
           startServers();
     
    @@ -1926,32 +1927,32 @@ public class SymmetricClusterTest extends ClusterTestBase
     
        protected void setupCluster(String addr1, String addr2, String addr3, String addr4, String addr5) throws Exception
        {
    -      setupClusterConnection("cluster0", addr1, true, 1, isNetty(), 0, 1, 2, 3, 4);
    +      setupClusterConnection("cluster0", addr1, MessageLoadBalancingType.STRICT, 1, isNetty(), 0, 1, 2, 3, 4);
     
    -      setupClusterConnection("cluster1", addr2, true, 1, isNetty(), 1, 0, 2, 3, 4);
    +      setupClusterConnection("cluster1", addr2, MessageLoadBalancingType.STRICT, 1, isNetty(), 1, 0, 2, 3, 4);
     
    -      setupClusterConnection("cluster2", addr3, true, 1, isNetty(), 2, 0, 1, 3, 4);
    +      setupClusterConnection("cluster2", addr3, MessageLoadBalancingType.STRICT, 1, isNetty(), 2, 0, 1, 3, 4);
     
    -      setupClusterConnection("cluster3", addr4, true, 1, isNetty(), 3, 0, 1, 2, 4);
    -      setupClusterConnection("cluster4", addr5, true, 1, isNetty(), 4, 0, 1, 2, 3);
    +      setupClusterConnection("cluster3", addr4, MessageLoadBalancingType.STRICT, 1, isNetty(), 3, 0, 1, 2, 4);
    +      setupClusterConnection("cluster4", addr5, MessageLoadBalancingType.STRICT, 1, isNetty(), 4, 0, 1, 2, 3);
        }
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2, 3, 4);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1, 2, 3, 4);
     
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0, 2, 3, 4);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0, 2, 3, 4);
     
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 0, 1, 3, 4);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 2, 0, 1, 3, 4);
     
    -      setupClusterConnection("cluster3", "queues", forwardWhenNoConsumers, 1, isNetty(), 3, 0, 1, 2, 4);
    +      setupClusterConnection("cluster3", "queues", messageLoadBalancingType, 1, isNetty(), 3, 0, 1, 2, 4);
     
    -      setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
    +      setupClusterConnection("cluster4", "queues", messageLoadBalancingType, 1, isNetty(), 4, 0, 1, 2, 3);
        }
     
        protected void setupServers() throws Exception
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
    index 209fa4dc42..9dc3b2f4b8 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithBackupTest.java
    @@ -17,6 +17,7 @@
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
     import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.junit.Test;
    @@ -441,12 +442,12 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
        }
     
        @Override
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
           // The lives
           setupClusterConnectionWithBackups("cluster0",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             0,
    @@ -454,7 +455,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster1",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             1,
    @@ -462,7 +463,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster2",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             2,
    @@ -470,7 +471,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster3",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             3,
    @@ -478,7 +479,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster4",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             4,
    @@ -488,7 +489,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster0",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             5,
    @@ -496,7 +497,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster1",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             6,
    @@ -504,7 +505,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster2",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             7,
    @@ -512,7 +513,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster3",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             8,
    @@ -520,7 +521,7 @@ public class SymmetricClusterWithBackupTest extends SymmetricClusterTest
     
           setupClusterConnectionWithBackups("cluster4",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             9,
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
    index da80bfb231..c4dad42cd3 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/SymmetricClusterWithDiscoveryTest.java
    @@ -17,6 +17,7 @@
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     
    @@ -36,21 +37,21 @@ public class SymmetricClusterWithDiscoveryTest extends SymmetricClusterTest
        @Override
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
        @Override
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
     
    -      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
     
    -      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
     
    -      setupDiscoveryClusterConnection("cluster3", 3, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster3", 3, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
     
    -      setupDiscoveryClusterConnection("cluster4", 4, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster4", 4, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
        }
     
        @Override
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
    index dda13776e8..9987192ed8 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TemporaryQueueClusterTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     
     import org.junit.Test;
    @@ -91,13 +92,13 @@ public class TemporaryQueueClusterTest extends ClusterTestBase
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1);
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0);
        }
     
        protected void setupServers() throws Exception
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
    index df29352c09..52fbe3151c 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.junit.Before;
     import org.junit.Test;
    @@ -42,8 +43,8 @@ public class TwoWayTwoNodeClusterTest extends ClusterTestBase
     
        protected void setupClusters()
        {
    -      setupClusterConnection("cluster0", 0, 1, "queues", false, 1, isNetty(), false);
    -      setupClusterConnection("cluster1", 1, 0, "queues", false, 1, isNetty(), false);
    +      setupClusterConnection("cluster0", 0, 1, "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), false);
    +      setupClusterConnection("cluster1", 1, 0, "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), false);
        }
     
        protected boolean isNetty()
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java
    index 14cd241174..024966ff7d 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/TwoWayTwoNodeClusterWithDiscoveryTest.java
    @@ -16,6 +16,8 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.distribution;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
    +
     public class TwoWayTwoNodeClusterWithDiscoveryTest extends TwoWayTwoNodeClusterTest
     {
     
    @@ -40,8 +42,8 @@ public class TwoWayTwoNodeClusterWithDiscoveryTest extends TwoWayTwoNodeClusterT
        @Override
        protected void setupClusters()
        {
    -      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", false, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", false, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty());
        }
     
        @Override
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
    index 1e93e8918c..3e886e864d 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java
    @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.failover;
     import java.util.HashSet;
     
     import org.apache.activemq.artemis.api.core.client.ClientSession;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
    @@ -33,7 +34,7 @@ public abstract class ClusterWithBackupFailoverTestBase extends ClusterTestBase
        protected static final String QUEUES_TESTADDRESS = "queues.testaddress";
        private static final IntegrationTestLogger log = IntegrationTestLogger.LOGGER;
     
    -   protected abstract void setupCluster(final boolean forwardWhenNoConsumers) throws Exception;
    +   protected abstract void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception;
     
        protected abstract void setupServers() throws Exception;
     
    @@ -268,7 +269,7 @@ public abstract class ClusterWithBackupFailoverTestBase extends ClusterTestBase
     
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
    index eec0fbb415..9d16b45f71 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/DiscoveryClusterWithBackupFailoverTest.java
    @@ -17,6 +17,8 @@
     package org.apache.activemq.artemis.tests.integration.cluster.failover;
     
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
    +
     public class DiscoveryClusterWithBackupFailoverTest extends ClusterWithBackupFailoverTestBase
     {
     
    @@ -25,19 +27,19 @@ public class DiscoveryClusterWithBackupFailoverTest extends ClusterWithBackupFai
        protected final int groupPort = getUDPDiscoveryPort();
     
        @Override
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
           // The lives
     
    -      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
     
           // The backups
     
    -      setupDiscoveryClusterConnection("cluster0", 3, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster1", 4, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster2", 5, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster0", 3, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster1", 4, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster2", 5, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
        }
     
        @Override
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
    index c737909020..7ca26e7cbe 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/GroupingFailoverTestBase.java
    @@ -26,6 +26,7 @@ import org.apache.activemq.artemis.api.core.client.ServerLocator;
     import org.apache.activemq.artemis.core.client.impl.TopologyMemberImpl;
     import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
     import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.server.group.impl.GroupingHandlerConfiguration;
     import org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
    @@ -44,11 +45,11 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase
     
           setupLiveServer(1, isFileStorage(), isSharedStore(), isNetty(), false);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 2, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
     
    @@ -143,11 +144,11 @@ public abstract class GroupingFailoverTestBase extends ClusterTestBase
     
           setupLiveServer(1, isFileStorage(), isSharedStore(), isNetty(), false);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 2, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 1);
     
           setUpGroupHandler(GroupingHandlerConfiguration.TYPE.LOCAL, 0);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java
    index 6019a814aa..e5db567d39 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedDistributionTest.java
    @@ -23,6 +23,7 @@ import org.apache.activemq.artemis.api.core.client.ClientMessage;
     import org.apache.activemq.artemis.api.core.client.ClientProducer;
     import org.apache.activemq.artemis.api.core.client.ClientSession;
     import org.apache.activemq.artemis.core.client.impl.ClientSessionInternal;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
     import org.apache.activemq.artemis.spi.core.protocol.RemotingConnection;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
    @@ -194,9 +195,9 @@ public class ReplicatedDistributionTest extends ClusterTestBase
     
           final String address = ReplicatedDistributionTest.ADDRESS.toString();
           // notice the abuse of the method call, '3' is not a backup for '1'
    -      setupClusterConnectionWithBackups("test", address, false, 1, true, 1, new int[]{3});
    -      setupClusterConnectionWithBackups("test", address, false, 1, true, 3, new int[]{2, 1});
    -      setupClusterConnectionWithBackups("test", address, false, 1, true, 2, new int[]{3});
    +      setupClusterConnectionWithBackups("test", address, MessageLoadBalancingType.ON_DEMAND, 1, true, 1, new int[]{3});
    +      setupClusterConnectionWithBackups("test", address, MessageLoadBalancingType.ON_DEMAND, 1, true, 3, new int[]{2, 1});
    +      setupClusterConnectionWithBackups("test", address, MessageLoadBalancingType.ON_DEMAND, 1, true, 2, new int[]{3});
     
           AddressSettings as = new AddressSettings().setRedistributionDelay(0);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/StaticClusterWithBackupFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/StaticClusterWithBackupFailoverTest.java
    index 420823d132..5555f7e88e 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/StaticClusterWithBackupFailoverTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/StaticClusterWithBackupFailoverTest.java
    @@ -16,15 +16,17 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.failover;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
    +
     public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailoverTestBase
     {
     
        @Override
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
           setupClusterConnectionWithBackups("cluster0",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             0,
    @@ -32,7 +34,7 @@ public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailov
     
           setupClusterConnectionWithBackups("cluster1",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             1,
    @@ -40,7 +42,7 @@ public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailov
     
           setupClusterConnectionWithBackups("cluster2",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             2,
    @@ -48,7 +50,7 @@ public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailov
     
           setupClusterConnectionWithBackups("cluster0",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             3,
    @@ -56,7 +58,7 @@ public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailov
     
           setupClusterConnectionWithBackups("cluster1",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             4,
    @@ -64,7 +66,7 @@ public class StaticClusterWithBackupFailoverTest extends ClusterWithBackupFailov
     
           setupClusterConnectionWithBackups("cluster2",
                                             "queues",
    -                                        forwardWhenNoConsumers,
    +                                        messageLoadBalancingType,
                                             1,
                                             isNetty(),
                                             5,
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
    index ceb11a698e..6aa9effabd 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/ha/HAAutomaticBackupSharedStore.java
    @@ -21,6 +21,7 @@ import org.apache.activemq.artemis.core.config.ha.ColocatedPolicyConfiguration;
     import org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration;
     import org.apache.activemq.artemis.core.config.ha.SharedStoreSlavePolicyConfiguration;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.junit.Before;
     import org.junit.Test;
    @@ -39,11 +40,11 @@ public class HAAutomaticBackupSharedStore extends ClusterTestBase
           setUpHAPolicy(1);
           setUpHAPolicy(2);
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
     
    -      setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster2", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
        }
     
        @Test
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java
    index 952248020f..c9e23fbd15 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/restart/ClusterRestartTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.restart;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Test;
     
     import java.util.Collection;
    @@ -35,9 +36,9 @@ public class ClusterRestartTest extends ClusterTestBase
           setupServer(0, isFileStorage(), isNetty());
           setupServer(1, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
     
           startServers(0, 1);
     
    @@ -100,9 +101,9 @@ public class ClusterRestartTest extends ClusterTestBase
           setupServer(0, isFileStorage(), isNetty());
           setupServer(1, isFileStorage(), isNetty());
     
    -      setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
     
    -      setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster1", "queues", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
     
           startServers(0, 1);
     
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyTest.java
    index 30a141619a..1ccec8b523 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyTest.java
    @@ -19,6 +19,7 @@ package org.apache.activemq.artemis.tests.integration.cluster.topology;
     import org.apache.activemq.artemis.api.core.TransportConfiguration;
     import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
     import org.apache.activemq.artemis.api.core.client.ServerLocator;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     
     public class HAClientTopologyTest extends TopologyClusterTestBase
    @@ -32,16 +33,16 @@ public class HAClientTopologyTest extends TopologyClusterTestBase
        @Override
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupClusterConnection("cluster0", "queues", forwardWhenNoConsumers, 1, isNetty(), 0, 1, 2, 3, 4);
    -      setupClusterConnection("cluster1", "queues", forwardWhenNoConsumers, 1, isNetty(), 1, 0, 2, 3, 4);
    -      setupClusterConnection("cluster2", "queues", forwardWhenNoConsumers, 1, isNetty(), 2, 0, 1, 3, 4);
    -      setupClusterConnection("cluster3", "queues", forwardWhenNoConsumers, 1, isNetty(), 3, 0, 1, 2, 4);
    -      setupClusterConnection("cluster4", "queues", forwardWhenNoConsumers, 1, isNetty(), 4, 0, 1, 2, 3);
    +      setupClusterConnection("cluster0", "queues", messageLoadBalancingType, 1, isNetty(), 0, 1, 2, 3, 4);
    +      setupClusterConnection("cluster1", "queues", messageLoadBalancingType, 1, isNetty(), 1, 0, 2, 3, 4);
    +      setupClusterConnection("cluster2", "queues", messageLoadBalancingType, 1, isNetty(), 2, 0, 1, 3, 4);
    +      setupClusterConnection("cluster3", "queues", messageLoadBalancingType, 1, isNetty(), 3, 0, 1, 2, 4);
    +      setupClusterConnection("cluster4", "queues", messageLoadBalancingType, 1, isNetty(), 4, 0, 1, 2, 3);
        }
     
        @Override
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
    index ad87ee1d37..cef51a8afd 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/HAClientTopologyWithDiscoveryTest.java
    @@ -20,6 +20,7 @@ import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
     import org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory;
     import org.apache.activemq.artemis.api.core.client.ActiveMQClient;
     import org.apache.activemq.artemis.api.core.client.ServerLocator;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     
     public class HAClientTopologyWithDiscoveryTest extends TopologyClusterTestBase
     {
    @@ -36,16 +37,16 @@ public class HAClientTopologyWithDiscoveryTest extends TopologyClusterTestBase
        @Override
        protected void setupCluster() throws Exception
        {
    -      setupCluster(false);
    +      setupCluster(MessageLoadBalancingType.ON_DEMAND);
        }
     
    -   protected void setupCluster(final boolean forwardWhenNoConsumers) throws Exception
    +   protected void setupCluster(final MessageLoadBalancingType messageLoadBalancingType) throws Exception
        {
    -      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster3", 3, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    -      setupDiscoveryClusterConnection("cluster4", 4, "dg1", "queues", forwardWhenNoConsumers, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster0", 0, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster1", 1, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster2", 2, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster3", 3, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
    +      setupDiscoveryClusterConnection("cluster4", 4, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
        }
     
        @Override
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java
    index 29f419abde..3e1c53d526 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java
    @@ -23,6 +23,7 @@ import org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration;
     import org.apache.activemq.artemis.core.config.Configuration;
     import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.junit.Assert;
     import org.junit.Test;
    @@ -129,6 +130,7 @@ public class IsolatedTopologyTest extends ActiveMQTestBase
              .setConnectorName("local-cc1")
              .setRetryInterval(250)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(connectTo);
     
           ArrayList connectTo2 = new ArrayList();
    @@ -140,6 +142,7 @@ public class IsolatedTopologyTest extends ActiveMQTestBase
              .setConnectorName("local-cc2")
              .setRetryInterval(250)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(connectTo2);
     
           // Server1 with two acceptors, each acceptor on a different cluster connection
    @@ -186,6 +189,7 @@ public class IsolatedTopologyTest extends ActiveMQTestBase
              .setConnectorName("local-cc1")
              .setRetryInterval(250)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(connectTo);
     
           List connectTo2 = new ArrayList();
    @@ -197,6 +201,7 @@ public class IsolatedTopologyTest extends ActiveMQTestBase
              .setConnectorName("local-cc2")
              .setRetryInterval(250)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(connectTo2);
     
           // Server2 with two acceptors, each acceptor on a different cluster connection
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java
    index d2cbe45d15..701722dd2b 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java
    @@ -16,6 +16,7 @@
      */
     package org.apache.activemq.artemis.tests.integration.cluster.topology;
     
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Test;
     
     import java.util.ArrayList;
    @@ -82,6 +83,7 @@ public class NonHATopologyTest extends ActiveMQTestBase
                    .setConnectorName("netty")
                    .setRetryInterval(1000)
                    .setConfirmationWindowSize(1000)
    +               .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
                    .setStaticConnectors(list)
                    .setAllowDirectConnectionsOnly(true));
              }
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java
    index bf119a82aa..6b3605ea19 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.cluster.util;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.apache.activemq.artemis.core.config.ha.ReplicaPolicyConfiguration;
     import org.apache.activemq.artemis.core.config.ha.ReplicatedPolicyConfiguration;
    @@ -221,6 +222,7 @@ public class MultiServerTestBase extends ActiveMQTestBase
              .setConnectorName("thisConnector")
              .setRetryInterval(100)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(targetServersOnConnection);
     
           configuration.getClusterConfigurations().add(clusterConf);
    @@ -278,6 +280,7 @@ public class MultiServerTestBase extends ActiveMQTestBase
              .setConnectorName("thisConnector")
              .setRetryInterval(100)
              .setConfirmationWindowSize(1024)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(targetServersOnConnection);
     
           configuration.getClusterConfigurations().add(clusterConf);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java
    index d8a27c3812..85a0d12602 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.management;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.junit.Before;
     import org.junit.After;
    @@ -144,7 +145,7 @@ public class ClusterConnectionControl2Test extends ManagementTestBase
              .setConnectorName("netty")
              .setRetryInterval(1000)
              .setDuplicateDetection(false)
    -         .setForwardWhenNoConsumers(false)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setMaxHops(1)
              .setConfirmationWindowSize(1024)
              .setDiscoveryGroupName(discoveryName);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java
    index e3e3daaf73..bb0fc7b9a8 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java
    @@ -15,6 +15,7 @@
      * limitations under the License.
      */
     package org.apache.activemq.artemis.tests.integration.management;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.junit.Before;
     import org.junit.After;
     import org.junit.Test;
    @@ -83,8 +84,8 @@ public class ClusterConnectionControlTest extends ManagementTestBase
           Assert.assertEquals(clusterConnectionConfig1.getRetryInterval(), clusterConnectionControl.getRetryInterval());
           Assert.assertEquals(clusterConnectionConfig1.isDuplicateDetection(),
                               clusterConnectionControl.isDuplicateDetection());
    -      Assert.assertEquals(clusterConnectionConfig1.isForwardWhenNoConsumers(),
    -                          clusterConnectionControl.isForwardWhenNoConsumers());
    +      Assert.assertEquals(clusterConnectionConfig1.getMessageLoadBalancingType().getType(),
    +                          clusterConnectionControl.getMessageLoadBalancingType());
           Assert.assertEquals(clusterConnectionConfig1.getMaxHops(), clusterConnectionControl.getMaxHops());
     
           Object[] connectors = clusterConnectionControl.getStaticConnectors();
    @@ -117,8 +118,8 @@ public class ClusterConnectionControlTest extends ManagementTestBase
           Assert.assertEquals(clusterConnectionConfig2.getRetryInterval(), clusterConnectionControl.getRetryInterval());
           Assert.assertEquals(clusterConnectionConfig2.isDuplicateDetection(),
                               clusterConnectionControl.isDuplicateDetection());
    -      Assert.assertEquals(clusterConnectionConfig2.isForwardWhenNoConsumers(),
    -                          clusterConnectionControl.isForwardWhenNoConsumers());
    +      Assert.assertEquals(clusterConnectionConfig2.getMessageLoadBalancingType().getType(),
    +                          clusterConnectionControl.getMessageLoadBalancingType());
           Assert.assertEquals(clusterConnectionConfig2.getMaxHops(), clusterConnectionControl.getMaxHops());
     
           Object[] connectorPairs = clusterConnectionControl.getStaticConnectors();
    @@ -242,9 +243,10 @@ public class ClusterConnectionControlTest extends ManagementTestBase
              .setConnectorName(connectorConfig.getName())
              .setRetryInterval(RandomUtil.randomPositiveLong())
              .setDuplicateDetection(RandomUtil.randomBoolean())
    -         .setForwardWhenNoConsumers(RandomUtil.randomBoolean())
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.STRICT)
              .setMaxHops(RandomUtil.randomPositiveInt())
              .setConfirmationWindowSize(RandomUtil.randomPositiveInt())
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setStaticConnectors(connectors);
     
           clusterConnectionConfig2 = new ClusterConnectionConfiguration()
    @@ -253,9 +255,10 @@ public class ClusterConnectionControlTest extends ManagementTestBase
              .setConnectorName(connectorConfig.getName())
              .setRetryInterval(RandomUtil.randomPositiveLong())
              .setDuplicateDetection(RandomUtil.randomBoolean())
    -         .setForwardWhenNoConsumers(RandomUtil.randomBoolean())
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.OFF)
              .setMaxHops(RandomUtil.randomPositiveInt())
              .setConfirmationWindowSize(RandomUtil.randomPositiveInt())
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
              .setDiscoveryGroupName(discoveryGroupName);
     
           Configuration conf_0 = createBasicConfig()
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlUsingCoreTest.java
    index bc11ac5930..9e9742cc4d 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlUsingCoreTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlUsingCoreTest.java
    @@ -98,9 +98,9 @@ public class ClusterConnectionControlUsingCoreTest extends ClusterConnectionCont
                 return (Boolean) proxy.retrieveAttributeValue("duplicateDetection");
              }
     
    -         public boolean isForwardWhenNoConsumers()
    +         public String getMessageLoadBalancingType()
              {
    -            return (Boolean) proxy.retrieveAttributeValue("forwardWhenNoConsumers");
    +            return (String) proxy.retrieveAttributeValue("messageLoadBalancingType");
              }
     
              public String getName()
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java
    index 55b1f0314c..3f0b08dbfe 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java
    @@ -34,6 +34,7 @@ import org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory
     import org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnectorFactory;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
     import org.apache.activemq.artemis.core.server.ActiveMQServers;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.settings.impl.AddressFullMessagePolicy;
     import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
    @@ -117,7 +118,7 @@ public class SpawnedServerSupport
              .setConnectorName(connectorName)
              .setRetryInterval(10)
              .setDuplicateDetection(false)
    -         .setForwardWhenNoConsumers(true)
    +         .setMessageLoadBalancingType(MessageLoadBalancingType.STRICT)
              .setConfirmationWindowSize(1)
              .setStaticConnectors(connectorList);
     
    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 68c2f636df..72da63e5ea 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
    @@ -30,6 +30,7 @@ import org.apache.activemq.artemis.core.persistence.impl.journal.LargeServerMess
     import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
     import org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants;
     import org.apache.activemq.artemis.core.server.Queue;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
    @@ -58,9 +59,9 @@ public class ScaleDown3NodeTest extends ClusterTestBase
           scaleDownConfiguration1.setGroupName("bill");
           scaleDownConfiguration1.setEnabled(false);
     
    -      setupClusterConnection("cluster0", "testAddress", false, 1, isNetty(), 0, 1, 2);
    -      setupClusterConnection("cluster0", "testAddress", false, 1, isNetty(), 1, 0, 2);
    -      setupClusterConnection("cluster0", "testAddress", false, 1, isNetty(), 2, 0, 1);
    +      setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1, 2);
    +      setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0, 2);
    +      setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 2, 0, 1);
           String scaleDownConnector = servers[0].getConfiguration().getClusterConfigurations().get(0).getStaticConnectors().get(0);
           Assert.assertEquals(61617, servers[0].getConfiguration().getConnectorConfigurations().get(scaleDownConnector).getParams().get(TransportConstants.PORT_PROP_NAME));
           scaleDownConfiguration0.getConnectors().add(scaleDownConnector);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
    index 17f9fb6318..dacc488c88 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ScaleDownTest.java
    @@ -28,6 +28,7 @@ import org.apache.activemq.artemis.core.config.ScaleDownConfiguration;
     import org.apache.activemq.artemis.core.config.ha.LiveOnlyPolicyConfiguration;
     import org.apache.activemq.artemis.core.postoffice.Binding;
     import org.apache.activemq.artemis.core.postoffice.impl.LocalQueueBinding;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
     import org.apache.activemq.artemis.tests.integration.cluster.distribution.ClusterTestBase;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
    @@ -78,8 +79,8 @@ public class ScaleDownTest extends ClusterTestBase
              haPolicyConfiguration0.getScaleDownConfiguration().setGroupName("bill");
              haPolicyConfiguration1.getScaleDownConfiguration().setGroupName("bill");
           }
    -      setupClusterConnection("cluster0", "testAddress", false, 1, isNetty(), 0, 1);
    -      setupClusterConnection("cluster0", "testAddress", false, 1, isNetty(), 1, 0);
    +      setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 0, 1);
    +      setupClusterConnection("cluster0", "testAddress", MessageLoadBalancingType.ON_DEMAND, 1, isNetty(), 1, 0);
           haPolicyConfiguration0.getScaleDownConfiguration().getConnectors().addAll(servers[0].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
           haPolicyConfiguration1.getScaleDownConfiguration().getConnectors().addAll(servers[1].getConfiguration().getClusterConfigurations().iterator().next().getStaticConnectors());
           startServers(0, 1);
    diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java
    index dd4cd80001..bf15ee5f84 100644
    --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java
    +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSClusteredTestBase.java
    @@ -25,6 +25,7 @@ import org.apache.activemq.artemis.core.registry.JndiBindingRegistry;
     import org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory;
     import org.apache.activemq.artemis.core.server.ActiveMQServer;
     import org.apache.activemq.artemis.core.server.ActiveMQServers;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl;
     import org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl;
     import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
    @@ -191,7 +192,13 @@ public class JMSClusteredTestBase extends ActiveMQTestBase
                                                    .setRetryInterval(1000)
                                                    .setMaxHops(MAX_HOPS)
                                                    .setConfirmationWindowSize(1024)
    -                                               .setStaticConnectors(new ArrayList() { { add(destinationLabel); } } ));
    +                                               .setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND)
    +                                               .setStaticConnectors(new ArrayList()
    +                                               {
    +                                                  {
    +                                                     add(destinationLabel);
    +                                                  }
    +                                               }));
     
           return configuration;
        }
    diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
    index c4a5f7b9ab..160668670c 100644
    --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
    +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java
    @@ -20,6 +20,7 @@ import java.util.ArrayList;
     import java.util.Collection;
     
     import org.apache.activemq.artemis.api.core.SimpleString;
    +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
     import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
     import org.apache.activemq.artemis.core.filter.Filter;
     import org.apache.activemq.artemis.core.postoffice.Binding;
    @@ -230,7 +231,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase
           }
     
           @Override
    -      public void setRouteWhenNoConsumers(boolean takePriorityIntoAccount)
    +      public void setMessageLoadBalancingType(MessageLoadBalancingType messageLoadBalancingType)
           {
     
           }