use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project camel by apache.
the class Jms2TestSupport method configureBroker.
protected void configureBroker(EmbeddedJMS broker) throws Exception {
Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setJournalDirectory("target/data/journal").setSecurityEnabled(false).addAcceptorConfiguration("connector", brokerUri + "?protocols=CORE,AMQP,HORNETQ,OPENWIRE").addAcceptorConfiguration("vm", "vm://broker").addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName()));
JMSConfiguration jmsConfig = new JMSConfigurationImpl();
ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(Arrays.asList("connector")).setBindings("cf");
jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1");
jmsConfig.getQueueConfigurations().add(queueConfig);
broker.setConfiguration(configuration).setJmsConfiguration(jmsConfig);
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class EmbeddedBrokerTestSupport method createArtemisBroker.
public EmbeddedJMS createArtemisBroker() throws Exception {
Configuration config0 = createConfig("localhost", 0);
EmbeddedJMS newbroker = new EmbeddedJMS().setConfiguration(config0).setJmsConfiguration(new JMSConfigurationImpl());
return newbroker;
}
use of org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl in project activemq-artemis by apache.
the class JMSConfigurationTest method testSetupJMSConfiguration.
@Test
public void testSetupJMSConfiguration() throws Exception {
Context context = new InVMNamingContext();
ActiveMQServer coreServer = new ActiveMQServerImpl(createDefaultInVMConfig());
JMSConfiguration jmsConfiguration = new JMSConfigurationImpl();
TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName());
List<TransportConfiguration> transportConfigs = new ArrayList<>();
transportConfigs.add(connectorConfig);
ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName(RandomUtil.randomString()).setConnectorNames(registerConnectors(coreServer, transportConfigs)).setBindings("/cf/binding1", "/cf/binding2");
jmsConfiguration.getConnectionFactoryConfigurations().add(cfConfig);
JMSQueueConfigurationImpl queueConfig = new JMSQueueConfigurationImpl().setName(RandomUtil.randomString()).setDurable(false).setBindings("/queue/binding1", "/queue/binding2");
jmsConfiguration.getQueueConfigurations().add(queueConfig);
TopicConfiguration topicConfig = new TopicConfigurationImpl().setName(RandomUtil.randomString()).setBindings("/topic/binding1", "/topic/binding2");
jmsConfiguration.getTopicConfigurations().add(topicConfig);
JMSServerManager server = new JMSServerManagerImpl(coreServer, jmsConfiguration);
server.setRegistry(new JndiBindingRegistry(context));
server.start();
for (String binding : cfConfig.getBindings()) {
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof ConnectionFactory);
ConnectionFactory cf = (ConnectionFactory) o;
Connection connection = cf.createConnection();
connection.close();
}
for (String binding : queueConfig.getBindings()) {
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof Queue);
Queue queue = (Queue) o;
Assert.assertEquals(queueConfig.getName(), queue.getQueueName());
}
for (String binding : topicConfig.getBindings()) {
Object o = context.lookup(binding);
Assert.assertNotNull(o);
Assert.assertTrue(o instanceof Topic);
Topic topic = (Topic) o;
Assert.assertEquals(topicConfig.getName(), topic.getTopicName());
}
server.stop();
}
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));
}
Aggregations