use of org.apache.activemq.xbean.BrokerFactoryBean in project activemq-artemis by apache.
the class NetworkRestartTest method createBroker.
protected BrokerService createBroker(String uri) throws Exception {
Resource resource = new ClassPathResource(uri);
BrokerFactoryBean factory = new BrokerFactoryBean(resource);
resource = new ClassPathResource(uri);
factory = new BrokerFactoryBean(resource);
factory.afterPropertiesSet();
BrokerService result = factory.getBroker();
return result;
}
use of org.apache.activemq.xbean.BrokerFactoryBean in project activemq-artemis by apache.
the class SimpleNetworkTest method createBroker.
protected BrokerService createBroker(String uri) throws Exception {
Resource resource = new ClassPathResource(uri);
BrokerFactoryBean factory = new BrokerFactoryBean(resource);
resource = new ClassPathResource(uri);
factory = new BrokerFactoryBean(resource);
factory.afterPropertiesSet();
BrokerService result = factory.getBroker();
return result;
}
use of org.apache.activemq.xbean.BrokerFactoryBean in project activemq-artemis by apache.
the class CompressionOverNetworkTest method createBroker.
protected BrokerService createBroker(String uri) throws Exception {
Resource resource = new ClassPathResource(uri);
BrokerFactoryBean factory = new BrokerFactoryBean(resource);
resource = new ClassPathResource(uri);
factory = new BrokerFactoryBean(resource);
factory.afterPropertiesSet();
BrokerService result = factory.getBroker();
for (NetworkConnector connector : result.getNetworkConnectors()) {
connector.setUseCompression(true);
}
return result;
}
use of org.apache.activemq.xbean.BrokerFactoryBean in project activemq-artemis by apache.
the class JDBCConfigTest method createBroker.
protected BrokerService createBroker(Resource resource) throws Exception {
BrokerFactoryBean factory = new BrokerFactoryBean(resource);
factory.afterPropertiesSet();
BrokerService broker = factory.getBroker();
assertTrue("Should have a broker!", broker != null);
return broker;
}
use of org.apache.activemq.xbean.BrokerFactoryBean in project activemq-artemis by apache.
the class Consumer method setUp.
/**
* @throws java.lang.Exception
*/
@Override
protected void setUp() throws Exception {
LOG.info("setUp() called.");
ClassPathXmlApplicationContext context1 = null;
BrokerFactoryBean brokerFactory = new BrokerFactoryBean(new ClassPathResource(config));
assertNotNull(brokerFactory);
/* start up first broker instance */
try {
// resolve broker1
Thread.currentThread().setContextClassLoader(NetworkedSyncTest.class.getClassLoader());
context1 = new ClassPathXmlApplicationContext(config);
broker1 = (BrokerService) context1.getBean("broker1");
// start the broker
if (!broker1.isStarted()) {
LOG.info("Broker broker1 not yet started. Kicking it off now.");
broker1.start();
} else {
LOG.info("Broker broker1 already started. Not kicking it off a second time.");
broker1.waitUntilStopped();
}
} catch (Exception e) {
LOG.error("Error: " + e.getMessage());
throw e;
// brokerService.stop();
}
/* start up second broker instance */
try {
Thread.currentThread().setContextClassLoader(NetworkedSyncTest.class.getClassLoader());
context1 = new ClassPathXmlApplicationContext(config);
broker2 = (BrokerService) context1.getBean("broker2");
// start the broker
if (!broker2.isStarted()) {
LOG.info("Broker broker2 not yet started. Kicking it off now.");
broker2.start();
} else {
LOG.info("Broker broker2 already started. Not kicking it off a second time.");
broker2.waitUntilStopped();
}
} catch (Exception e) {
LOG.error("Error: " + e.getMessage());
throw e;
}
// setup network connector from broker1 to broker2
connector = broker1.addNetworkConnector(networkConnectorURL);
connector.setBrokerName(broker1.getBrokerName());
connector.setDuplex(true);
connector.start();
LOG.info("Network connector created.");
}
Aggregations