Search in sources :

Example 46 with BrokerService

use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.

the class LevelDBStoreBrokerTest method createBroker.

@Override
protected BrokerService createBroker() throws Exception {
    BrokerService broker = new BrokerService();
    broker.setPersistenceAdapter(createPersistenceAdapter(true));
    return broker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 47 with BrokerService

use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.

the class LoadTest method createBroker.

/**
 * Factory method to create a new broker
 *
 * @throws Exception
 */
protected BrokerService createBroker(String uri) throws Exception {
    BrokerService answer = new BrokerService();
    configureBroker(answer, uri);
    answer.start();
    return answer;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 48 with BrokerService

use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.

the class BrokerNetworkWithStuckMessagesTest method createRemoteBroker.

protected BrokerService createRemoteBroker() throws Exception {
    remoteBroker = new BrokerService();
    remoteBroker.setBrokerName("remotehost");
    remoteBroker.setUseJmx(true);
    remoteBroker.setPersistenceAdapter(null);
    remoteBroker.setPersistent(false);
    remoteConnector = createRemoteConnector();
    remoteBroker.addConnector(remoteConnector);
    configureBroker(remoteBroker);
    remoteBroker.start();
    remoteBroker.waitUntilStarted();
    remoteBroker.getManagementContext().setConnectorPort(2222);
    brokers.put(remoteBroker.getBrokerName(), remoteBroker);
    return remoteBroker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 49 with BrokerService

use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.

the class AMQ3410Test method tearDown.

@Override
protected void tearDown() throws Exception {
    BrokerService broker = (BrokerService) context.getBean("localbroker");
    broker.stop();
    broker = (BrokerService) context.getBean("default");
    broker.stop();
    super.tearDown();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 50 with BrokerService

use of org.apache.activemq.broker.BrokerService in project activemq-artemis by apache.

the class RedeliveryPluginTest method testInstallPluginValidation.

public void testInstallPluginValidation() throws Exception {
    RedeliveryPolicyMap redeliveryPolicyMap = new RedeliveryPolicyMap();
    RedeliveryPolicy defaultEntry = new RedeliveryPolicy();
    defaultEntry.setInitialRedeliveryDelay(500);
    redeliveryPolicyMap.setDefaultEntry(defaultEntry);
    underTest.setRedeliveryPolicyMap(redeliveryPolicyMap);
    final BrokerService brokerService = new BrokerService();
    brokerService.setSchedulerSupport(false);
    Broker broker = new ErrorBroker("hi") {

        @Override
        public BrokerService getBrokerService() {
            return brokerService;
        }
    };
    try {
        underTest.installPlugin(broker);
        fail("expect exception on no scheduler support");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
    brokerService.setSchedulerSupport(true);
    try {
        underTest.installPlugin(broker);
        fail("expect exception on small initial delay");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
    defaultEntry.setInitialRedeliveryDelay(5000);
    defaultEntry.setRedeliveryDelay(500);
    brokerService.setSchedulerSupport(true);
    try {
        underTest.installPlugin(broker);
        fail("expect exception on small redelivery delay");
    } catch (Exception expected) {
        LOG.info("expected: " + expected);
    }
}
Also used : Broker(org.apache.activemq.broker.Broker) ErrorBroker(org.apache.activemq.broker.ErrorBroker) ErrorBroker(org.apache.activemq.broker.ErrorBroker) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) RedeliveryPolicyMap(org.apache.activemq.broker.region.policy.RedeliveryPolicyMap) BrokerService(org.apache.activemq.broker.BrokerService)

Aggregations

BrokerService (org.apache.activemq.broker.BrokerService)349 URI (java.net.URI)53 PolicyEntry (org.apache.activemq.broker.region.policy.PolicyEntry)45 PolicyMap (org.apache.activemq.broker.region.policy.PolicyMap)45 Test (org.junit.Test)43 ActiveMQConnectionFactory (org.apache.activemq.ActiveMQConnectionFactory)32 TransportConnector (org.apache.activemq.broker.TransportConnector)31 Before (org.junit.Before)22 File (java.io.File)20 MemoryPersistenceAdapter (org.apache.activemq.store.memory.MemoryPersistenceAdapter)17 JMSException (javax.jms.JMSException)16 JDBCPersistenceAdapter (org.apache.activemq.store.jdbc.JDBCPersistenceAdapter)14 KahaDBPersistenceAdapter (org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter)14 BrokerFactoryBean (org.apache.activemq.xbean.BrokerFactoryBean)14 NetworkConnector (org.apache.activemq.network.NetworkConnector)13 MessageConsumer (javax.jms.MessageConsumer)12 PersistenceAdapter (org.apache.activemq.store.PersistenceAdapter)12 ArrayList (java.util.ArrayList)11 Destination (javax.jms.Destination)11 ClassPathResource (org.springframework.core.io.ClassPathResource)10