ARTEMIS-1688 fix cluster when auto-create-addresses=false

This commit is contained in:
Justin Bertram 2018-02-16 16:44:17 -06:00 committed by Clebert Suconic
parent 26c284bf58
commit 5ad45369ce
2 changed files with 48 additions and 0 deletions

View File

@ -540,6 +540,12 @@ public class ManagementServiceImpl implements ManagementService {
}
started = true;
/**
* Ensure the management notification address is created otherwise if auto-create-address = false then cluster
* bridges won't be able to connect.
*/
messagingServer.addAddressInfo(new AddressInfo(managementNotificationAddress, RoutingType.MULTICAST));
}
@Override

View File

@ -16,7 +16,11 @@
*/
package org.apache.activemq.artemis.tests.integration.cluster.distribution;
import org.apache.activemq.artemis.api.core.RoutingType;
import org.apache.activemq.artemis.api.core.SimpleString;
import org.apache.activemq.artemis.core.server.cluster.impl.MessageLoadBalancingType;
import org.apache.activemq.artemis.core.server.impl.AddressInfo;
import org.apache.activemq.artemis.core.settings.impl.AddressSettings;
import org.apache.activemq.artemis.tests.integration.IntegrationTestLogger;
import org.apache.activemq.artemis.tests.util.ActiveMQTestBase;
import org.junit.Before;
@ -229,6 +233,44 @@ public class SymmetricClusterTest extends ClusterTestBase {
verifyNotReceive(0, 1, 2, 3, 4);
}
@Test
public void testBasicRoundRobinManyMessagesNoAddressAutoCreate() throws Exception {
setupCluster();
startServers();
for (int i = 0; i < 5; i++) {
servers[i].getAddressSettingsRepository().addMatch("#", new AddressSettings().setAutoCreateAddresses(false).setAutoCreateQueues(false));
}
for (int i = 0; i < 5; i++) {
setupSessionFactory(i, isNetty());
}
for (int i = 0; i < 5; i++) {
servers[i].addAddressInfo(new AddressInfo(SimpleString.toSimpleString("queues.testaddress"), RoutingType.MULTICAST));
createQueue(i, "queues.testaddress", "queue0", null, false);
}
for (int i = 0; i < 5; i++) {
addConsumer(i, i, "queue0", null);
}
for (int i = 0; i < 5; i++) {
waitForBindings(i, "queues.testaddress", 1, 1, true);
}
for (int i = 0; i < 5; i++) {
waitForBindings(i, "queues.testaddress", 4, 4, false);
}
send(0, "queues.testaddress", 1000, true, null);
verifyReceiveRoundRobinInSomeOrder(1000, 0, 1, 2, 3, 4);
verifyNotReceive(0, 1, 2, 3, 4);
}
@Test
public void testRoundRobinMultipleQueues() throws Exception {
SymmetricClusterTest.log.info("starting");