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
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 QueueThis 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. +To run the example, simply type mvn verify -Pexample
from this directory
connection0 = cf0.createConnection();
- final String clientID = "my-client-id";
+ final String clientID = "my-client-id";
connection0.setClientID(clientID);
-
+
@@ -116,7 +116,7 @@ under the License. Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);- +
@@ -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");
}
-
+
finally
block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objectsFor more information on ActiveMQ Artemis clustering and grouping see the clustering and grouping - section of the user manual.
+ section of the user manual.To run the example, simply type mvn verify -Pexample
from this directory
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.To run the example, simply type mvn verify -Pexample
from this directory
@@ -102,7 +102,7 @@ under the License.
Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
@@ -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());
}
-
+
finally
block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objectsIn 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.To run the example, simply type mvn verify -Pexample
from this directory
@@ -105,7 +105,7 @@ under the License.
Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
@@ -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());
}
-
+
finally
block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objectsIn 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.To run the example, simply type mvn verify -Pexample
from this directory
@@ -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());
}
-
+
finally
block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objectsA 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.To run the example, simply type mvn verify -Pexample
from this directory
@@ -102,7 +102,7 @@ under the License.
Session session0 = connection0.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
+
@@ -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());
}
-
+
finally
block. Closing a JMS connection will automatically close all of its sessions, consumers, producer and browser objectsUsing 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.To run the example, simply type mvn verify -Pexample
from this directory
- 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);
-
+
@@ -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)
{
}