use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverPriorityTest method testPriorityBackupList.
@Test
public void testPriorityBackupList() throws Exception {
Configuration config0 = createConfig("127.0.0.1", 0);
Configuration config1 = createConfig("127.0.0.1", 1);
deployClusterConfiguration(config0, 1);
deployClusterConfiguration(config1, 0);
servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
servers[0].start();
servers[1].start();
Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
Thread.sleep(1000);
setClientUrl("failover:(" + BROKER_A_CLIENT_TC_ADDRESS + "," + BROKER_B_CLIENT_TC_ADDRESS + ")?randomize=false&priorityBackup=true&priorityURIs=tcp://127.0.0.1:61617&initialReconnectDelay=1000&useExponentialBackOff=false");
createClients(5);
Thread.sleep(3000);
assertAllConnectedTo(urls.get(1));
restart(false, 1, 0);
for (int i = 0; i < 3; i++) {
restart(true, 1, 0);
}
restart(false, 1, 0);
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverPriorityTest method testPriorityBackup.
@Test
public void testPriorityBackup() throws Exception {
Configuration config0 = createConfig("127.0.0.1", 0);
Configuration config1 = createConfig("127.0.0.1", 1);
deployClusterConfiguration(config0, 1);
deployClusterConfiguration(config1, 0);
servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
servers[0].start();
servers[1].start();
Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 2));
Thread.sleep(1000);
setClientUrl("failover:(" + BROKER_A_CLIENT_TC_ADDRESS + "," + BROKER_B_CLIENT_TC_ADDRESS + ")?randomize=false&priorityBackup=true&initialReconnectDelay=1000&useExponentialBackOff=false");
createClients(5);
assertAllConnectedTo(urls.get(0));
restart(false, 0, 1);
for (int i = 0; i < 3; i++) {
restart(true, 0, 1);
}
Thread.sleep(5000);
restart(false, 0, 1);
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverPriorityTest method setupThreeBrokers.
private void setupThreeBrokers() throws Exception {
params.put("rebalanceClusterClients", "false");
params.put("updateClusterClients", "false");
params.put("updateClusterClientsOnRemove", "false");
Configuration config0 = createConfig("127.0.0.1", 0, params);
Configuration config1 = createConfig("127.0.0.1", 1, params);
Configuration config2 = createConfig("127.0.0.1", 2, params);
deployClusterConfiguration(config0, 1, 2);
deployClusterConfiguration(config1, 0, 2);
deployClusterConfiguration(config2, 0, 1);
servers[0] = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
servers[1] = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
servers[2] = new EmbeddedJMS().setConfiguration(config2).setJmsConfiguration(new JMSConfigurationImpl());
servers[0].start();
servers[1].start();
servers[2].start();
Assert.assertTrue(servers[0].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
Assert.assertTrue(servers[1].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
Assert.assertTrue(servers[2].waitClusterForming(100, TimeUnit.MILLISECONDS, 20, 3));
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FailoverTimeoutTest method testTimeout.
@Test
public void testTimeout() throws Exception {
long timeout = 1000;
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + tcpUri + ")?timeout=" + timeout + "&useExponentialBackOff=false");
Connection connection = cf.createConnection();
try {
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(session.createQueue(QUEUE_NAME));
TextMessage message = session.createTextMessage("Test message");
producer.send(message);
server.stop();
try {
producer.send(message);
} catch (JMSException jmse) {
assertEquals("Failover timeout of " + timeout + " ms reached.", jmse.getMessage());
}
Configuration config = createConfig(0);
server = new EmbeddedJMS().setConfiguration(config).setJmsConfiguration(new JMSConfigurationImpl());
server.start();
producer.send(message);
server.stop();
server = null;
} finally {
if (connection != null) {
connection.close();
}
}
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class FanoutTransportBrokerTest method setUp.
@Before
public void setUp() throws Exception {
Configuration config0 = createConfig(0);
server = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
Configuration config1 = createConfig(1);
remoteServer = new EmbeddedJMS().setConfiguration(config1).setJmsConfiguration(new JMSConfigurationImpl());
server.start();
remoteServer.start();
}
Aggregations