Search in sources :

Example 51 with BrokerService

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

the class CheckDuplicateMessagesOnDuplexTest method createLocalBroker.

private void createLocalBroker() throws Exception {
    localBroker = new BrokerService();
    localBroker.setBrokerName("LOCAL");
    localBroker.setUseJmx(true);
    localBroker.setSchedulePeriodForDestinationPurge(5000);
    ManagementContext managementContext = new ManagementContext();
    managementContext.setCreateConnector(false);
    localBroker.setManagementContext(managementContext);
    PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local");
    localBroker.setPersistenceAdapter(persistenceAdapter);
    List<TransportConnector> transportConnectors = new ArrayList<>();
    DebugTransportFactory tf = new DebugTransportFactory();
    TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539"));
    TransportConnector transportConnector = new TransportConnector(transport);
    transportConnector.setName("tc");
    transportConnector.setAuditNetworkProducers(true);
    transportConnectors.add(transportConnector);
    localBroker.setTransportConnectors(transportConnectors);
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) ArrayList(java.util.ArrayList) ManagementContext(org.apache.activemq.broker.jmx.ManagementContext) TcpTransportServer(org.apache.activemq.transport.tcp.TcpTransportServer) TransportServer(org.apache.activemq.transport.TransportServer) BrokerService(org.apache.activemq.broker.BrokerService) LevelDBPersistenceAdapter(org.apache.activemq.store.leveldb.LevelDBPersistenceAdapter) KahaDBPersistenceAdapter(org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter) PersistenceAdapter(org.apache.activemq.store.PersistenceAdapter)

Example 52 with BrokerService

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

the class SecurityTestSupport method createBroker.

/**
 * Overrides to set the JMSXUserID flag to true.
 */
@Override
protected BrokerService createBroker() throws Exception {
    BrokerService broker = super.createBroker();
    broker.setPopulateJMSXUserID(true);
    return broker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 53 with BrokerService

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

the class BrokerStatisticsPluginTest method createBroker.

protected BrokerService createBroker() throws Exception {
    BrokerService answer = new BrokerService();
    BrokerPlugin[] plugins = new BrokerPlugin[1];
    plugins[0] = new StatisticsBrokerPlugin();
    answer.setPlugins(plugins);
    answer.setDeleteAllMessagesOnStartup(true);
    answer.addConnector("tcp://localhost:0");
    answer.start();
    return answer;
}
Also used : BrokerPlugin(org.apache.activemq.broker.BrokerPlugin) BrokerService(org.apache.activemq.broker.BrokerService)

Example 54 with BrokerService

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

the class ProxyTestSupport method createRemoteBroker.

protected BrokerService createRemoteBroker() throws Exception {
    BrokerService service = new BrokerService();
    service.setBrokerName("broker2");
    service.setPersistent(false);
    service.setUseJmx(false);
    remoteConnector = service.addConnector(getRemoteURI());
    remoteProxyConnector = new ProxyConnector();
    remoteProxyConnector.setName("remoteProxy");
    remoteProxyConnector.setBind(new URI(getRemoteProxyURI()));
    remoteProxyConnector.setRemote(new URI("fanout:static://" + getLocalURI()));
    service.addProxyConnector(remoteProxyConnector);
    return service;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) URI(java.net.URI)

Example 55 with BrokerService

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

the class InactiveDurableTopicTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    broker = new BrokerService();
    // broker.setPersistenceAdapter(new KahaPersistenceAdapter());
    /*
         * JournalPersistenceAdapterFactory factory = new
         * JournalPersistenceAdapterFactory();
         * factory.setDataDirectoryFile(broker.getDataDirectory());
         * factory.setTaskRunnerFactory(broker.getTaskRunnerFactory());
         * factory.setUseJournal(false); broker.setPersistenceFactory(factory);
         */
    broker.addConnector(ActiveMQConnectionFactory.DEFAULT_BROKER_BIND_URL);
    broker.start();
    connectionFactory = new ActiveMQConnectionFactory(ActiveMQConnectionFactory.DEFAULT_BROKER_URL);
    /*
         * Doesn't matter if you enable or disable these, so just leaving them
         * out for this test case connectionFactory.setAlwaysSessionAsync(true);
         * connectionFactory.setAsyncDispatch(true);
         */
    connectionFactory.setUseAsyncSend(true);
}
Also used : ActiveMQConnectionFactory(org.apache.activemq.ActiveMQConnectionFactory) 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