Search in sources :

Example 1 with BrokerService

use of org.apache.activemq.broker.BrokerService in project spring-framework by spring-projects.

the class StompBrokerRelayMessageHandlerIntegrationTests method startActiveMqBroker.

private void startActiveMqBroker() throws Exception {
    this.activeMQBroker = new BrokerService();
    this.activeMQBroker.addConnector("stomp://localhost:" + this.port);
    this.activeMQBroker.setStartAsync(false);
    this.activeMQBroker.setPersistent(false);
    this.activeMQBroker.setUseJmx(false);
    this.activeMQBroker.getSystemUsage().getMemoryUsage().setLimit(1024 * 1024 * 5);
    this.activeMQBroker.getSystemUsage().getTempUsage().setLimit(1024 * 1024 * 5);
    this.activeMQBroker.start();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 2 with BrokerService

use of org.apache.activemq.broker.BrokerService in project camel by apache.

the class MQTTDuplicatesTest method testMqttDuplicatesAfterBrokerRestartWithoutClientID.

@Test
public void testMqttDuplicatesAfterBrokerRestartWithoutClientID() throws Exception {
    brokerService.stop();
    brokerService.waitUntilStopped();
    LOG.info(">>>>>>>>>> Restarting broker...");
    brokerService = new BrokerService();
    brokerService.setPersistent(false);
    brokerService.setAdvisorySupport(false);
    brokerService.addConnector(MQTTTestSupport.getConnection() + "?trace=true");
    brokerService.start();
    brokerService.waitUntilStarted();
    LOG.info(">>>>>>>>>> Broker restarted");
    for (int i = 0; i < MESSAGE_COUNT; i++) {
        String body = System.currentTimeMillis() + ": Dummy-restart-without-clientID! " + i;
        templateWithoutClientID.asyncSendBody("direct:withoutClientID", body);
        Thread.sleep(WAIT_MILLIS);
    }
    assertNoDuplicates();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) MockEndpoint(org.apache.camel.component.mock.MockEndpoint) Test(org.junit.Test)

Example 3 with BrokerService

use of org.apache.activemq.broker.BrokerService in project camel by apache.

the class PahoComponentTest method doPreSetup.

@Override
public void doPreSetup() throws Exception {
    super.doPreSetup();
    broker = new BrokerService();
    broker.setPersistent(false);
    broker.addConnector("mqtt://localhost:" + mqttPort);
    broker.start();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 4 with BrokerService

use of org.apache.activemq.broker.BrokerService in project camel by apache.

the class JmsTestSupport method doPreSetup.

/** 
     * Set up the Broker
     *
     * @see org.apache.camel.test.junit4.CamelTestSupport#doPreSetup()
     *
     * @throws Exception
     */
@Override
protected void doPreSetup() throws Exception {
    deleteDirectory("target/activemq-data");
    broker = new BrokerService();
    int port = AvailablePortFinder.getNextAvailable(33333);
    brokerUri = "tcp://localhost:" + port;
    broker.getManagementContext().setConnectorPort(AvailablePortFinder.getNextAvailable(port + 1));
    configureBroker(broker);
    startBroker();
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService)

Example 5 with BrokerService

use of org.apache.activemq.broker.BrokerService in project camel by apache.

the class SjmsConnectionTestSupport method createBroker.

protected void createBroker() throws Exception {
    String connectString = getConnectionUri();
    if (ObjectHelper.isEmpty(connectString)) {
        connectString = TCP_BROKER_CONNECT_STRING;
    }
    brokerService = new BrokerService();
    brokerService.setPersistent(isPersistenceEnabled());
    brokerService.addConnector(connectString);
    brokerService.start();
    brokerService.waitUntilStarted();
}
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