Search in sources :

Example 1 with BrokerFactoryBean

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;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) BrokerService(org.apache.activemq.broker.BrokerService) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 2 with BrokerFactoryBean

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;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) BrokerService(org.apache.activemq.broker.BrokerService) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 3 with BrokerFactoryBean

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;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource) Resource(org.springframework.core.io.Resource) BrokerService(org.apache.activemq.broker.BrokerService) ClassPathResource(org.springframework.core.io.ClassPathResource)

Example 4 with BrokerFactoryBean

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;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) BrokerService(org.apache.activemq.broker.BrokerService)

Example 5 with BrokerFactoryBean

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.");
}
Also used : ClassPathXmlApplicationContext(org.apache.xbean.spring.context.ClassPathXmlApplicationContext) BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) ClassPathResource(org.springframework.core.io.ClassPathResource)

Aggregations

BrokerFactoryBean (org.apache.activemq.xbean.BrokerFactoryBean)18 BrokerService (org.apache.activemq.broker.BrokerService)14 ClassPathResource (org.springframework.core.io.ClassPathResource)13 Resource (org.springframework.core.io.Resource)6 JMSException (javax.jms.JMSException)1 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)1 ClassPathXmlApplicationContext (org.apache.xbean.spring.context.ClassPathXmlApplicationContext)1