gtully commented on a change in pull request #3867: URL: https://github.com/apache/activemq-artemis/pull/3867#discussion_r763079112
########## File path: tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/balancing/AutoClientIDShardClusterTest.java ########## @@ -0,0 +1,343 @@ +/** + * 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 + * <p> + * http://www.apache.org/licenses/LICENSE-2.0 + * <p> + * 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.balancing; + +import javax.jms.Connection; +import javax.jms.ConnectionFactory; +import javax.jms.Message; +import javax.jms.MessageProducer; +import javax.jms.Session; +import javax.jms.TopicSubscriber; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.activemq.artemis.api.core.SimpleString; +import org.apache.activemq.artemis.api.core.TransportConfiguration; +import org.apache.activemq.artemis.core.config.Configuration; +import org.apache.activemq.artemis.core.config.balancing.BrokerBalancerConfiguration; +import org.apache.activemq.artemis.core.config.balancing.NamedPropertyConfiguration; +import org.apache.activemq.artemis.core.postoffice.Binding; +import org.apache.activemq.artemis.core.postoffice.Bindings; +import org.apache.activemq.artemis.core.protocol.openwire.OpenWireProtocolManagerFactory; +import org.apache.activemq.artemis.core.server.balancing.targets.TargetKey; +import org.apache.activemq.artemis.core.server.balancing.targets.TargetKeyResolver; +import org.apache.activemq.artemis.core.server.balancing.transformer.ConsistentHashModulo; +import org.apache.activemq.artemis.core.server.cluster.RemoteQueueBinding; +import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType; +import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; +import org.apache.activemq.artemis.protocol.amqp.broker.ProtonProtocolManagerFactory; +import org.apache.activemq.artemis.utils.Wait; +import org.apache.qpid.jms.JmsConnectionFactory; +import org.junit.Ignore; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +@RunWith(Parameterized.class) +public class AutoClientIDShardClusterTest extends BalancingTestBase { + + @Parameterized.Parameters(name = "protocol: {0}") + public static Collection<Object[]> data() { + final String[] protocols = new String[] {AMQP_PROTOCOL, CORE_PROTOCOL, OPENWIRE_PROTOCOL}; + Collection<Object[]> data = new ArrayList<>(); + for (String protocol : protocols) { + data.add(new Object[] {protocol}); + } + return data; + } + + private final String protocol; + final int numMessages = 50; + AtomicInteger toSend = new AtomicInteger(numMessages); + + public AutoClientIDShardClusterTest(String protocol) { + this.protocol = protocol; + } + + protected void setupServers() throws Exception { + for (int i = 0; i < 2; i++) { + setupLiveServer(i, true, HAType.SharedNothingReplication, true, false); + servers[i].addProtocolManagerFactory(new ProtonProtocolManagerFactory()); + servers[i].addProtocolManagerFactory(new OpenWireProtocolManagerFactory()); + } + setupClusterConnection("cluster0", "T", MessageLoadBalancingType.ON_DEMAND, 1,true, 0, 1); + setupClusterConnection("cluster1", "T", MessageLoadBalancingType.ON_DEMAND, 1, true, 1, 0); + toSend.set(numMessages); + } + + Thread producer = new Thread(new Runnable() { + final AtomicInteger producerSeq = new AtomicInteger(); + + @Override + public void run() { + while (toSend.get() > 0) { Review comment: the bouncing use case, where it sends 5 in a batch and gets a random connection for each batch is the difference -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
