Search in sources :

Example 41 with BrokerService

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

the class BrokerNetworkWithStuckMessagesTest method createSecondRemoteBroker.

protected BrokerService createSecondRemoteBroker() throws Exception {
    secondRemoteBroker = new BrokerService();
    secondRemoteBroker.setBrokerName("secondRemotehost");
    secondRemoteBroker.setUseJmx(false);
    secondRemoteBroker.setPersistenceAdapter(null);
    secondRemoteBroker.setPersistent(false);
    secondRemoteConnector = createSecondRemoteConnector();
    secondRemoteBroker.addConnector(secondRemoteConnector);
    configureBroker(secondRemoteBroker);
    secondRemoteBroker.start();
    secondRemoteBroker.waitUntilStarted();
    brokers.put(secondRemoteBroker.getBrokerName(), secondRemoteBroker);
    return secondRemoteBroker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 42 with BrokerService

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

the class DuplexNetworkMBeanTest method testMbeanPresenceOnBrokerRestart.

@Test
public void testMbeanPresenceOnBrokerRestart() throws Exception {
    BrokerService networkedBroker = createNetworkedBroker();
    try {
        networkedBroker.start();
        assertEquals(1, countMbeans(networkedBroker, "connector=networkConnectors", 30000));
        assertEquals(0, countMbeans(networkedBroker, "connectionName"));
        BrokerService broker = null;
        for (int i = 0; i < numRestarts; i++) {
            broker = createBroker();
            try {
                broker.start();
                assertEquals(1, countMbeans(networkedBroker, "networkBridge", 5000));
                assertEquals("restart number: " + i, 2, countMbeans(broker, "connectionName", 10000));
            } finally {
                broker.stop();
                broker.waitUntilStopped();
            }
            assertEquals(0, countMbeans(broker, "stopped"));
        }
        assertEquals(1, countMbeans(networkedBroker, "connector=networkConnectors"));
        assertEquals(0, countMbeans(networkedBroker, "connectionName"));
        assertEquals(0, countMbeans(broker, "connectionName"));
    } finally {
        networkedBroker.stop();
        networkedBroker.waitUntilStopped();
    }
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) Test(org.junit.Test)

Example 43 with BrokerService

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

the class DuplexNetworkMBeanTest method createNetworkedBroker.

protected BrokerService createNetworkedBroker() throws Exception {
    BrokerService broker = new BrokerService();
    broker.setBrokerName("networkedBroker");
    broker.addConnector("tcp://localhost:62617?transport.reuseAddress=true");
    NetworkConnector networkConnector = broker.addNetworkConnector("static:(tcp://localhost:61617?wireFormat.maxInactivityDuration=500)?useExponentialBackOff=false");
    networkConnector.setDuplex(true);
    return broker;
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 44 with BrokerService

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

the class NetworkConnectionsTest method setUp.

@Override
protected void setUp() throws Exception {
    LOG.info("Setting up LocalBroker");
    localBroker = new BrokerService();
    localBroker.setBrokerName("LocalBroker");
    localBroker.setUseJmx(false);
    localBroker.setPersistent(false);
    localBroker.setTransportConnectorURIs(new String[] { LOCAL_BROKER_TRANSPORT_URI });
    localBroker.start();
    localBroker.waitUntilStarted();
    LOG.info("Setting up RemoteBroker");
    remoteBroker = new BrokerService();
    remoteBroker.setBrokerName("RemoteBroker");
    remoteBroker.setUseJmx(false);
    remoteBroker.setPersistent(false);
    remoteBroker.setTransportConnectorURIs(new String[] { REMOTE_BROKER_TRANSPORT_URI });
    remoteBroker.start();
    remoteBroker.waitUntilStarted();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 45 with BrokerService

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

the class NetworkRemovesSubscriptionsTest method setUp.

@Override
protected void setUp() throws Exception {
    this.backEnd = new BrokerService();
    this.backEnd.setBrokerName("backEnd");
    this.backEnd.setPersistent(false);
    NetworkConnector backEndNetwork = this.backEnd.addNetworkConnector("static://" + frontEndAddress);
    backEndNetwork.setName("backEndNetwork");
    backEndNetwork.setDynamicOnly(true);
    this.backEnd.addConnector(backEndAddress);
    this.backEnd.start();
    this.frontEnd = new BrokerService();
    this.frontEnd.setBrokerName("frontEnd");
    this.frontEnd.setPersistent(false);
    NetworkConnector frontEndNetwork = this.frontEnd.addNetworkConnector("static://" + backEndAddress);
    frontEndNetwork.setName("frontEndNetwork");
    this.frontEnd.addConnector(frontEndAddress);
    this.frontEnd.start();
    Thread.sleep(2000);
}
Also used : 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