Search in sources :

Example 76 with BrokerService

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

the class PublishOnQueueConsumedMessageUsingActivemqXMLTest method createBroker.

protected BrokerService createBroker(Resource resource) throws Exception {
    BrokerFactoryBean factory = new BrokerFactoryBean(resource);
    factory.afterPropertiesSet();
    BrokerService broker = factory.getBroker();
    return broker;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) BrokerService(org.apache.activemq.broker.BrokerService)

Example 77 with BrokerService

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

the class PublishOnTopicConsumerMessageUsingActivemqXMLTest method createBroker.

protected BrokerService createBroker(Resource resource) throws Exception {
    BrokerFactoryBean factory = new BrokerFactoryBean(resource);
    factory.afterPropertiesSet();
    BrokerService broker = factory.getBroker();
    return broker;
}
Also used : BrokerFactoryBean(org.apache.activemq.xbean.BrokerFactoryBean) BrokerService(org.apache.activemq.broker.BrokerService)

Example 78 with BrokerService

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

the class XBeanStartFalseTest method testStartFalse.

public void testStartFalse() throws Exception {
    BrokerService broker = BrokerFactory.createBroker(new URI("xbean:org/apache/activemq/xbean/activemq2.xml"));
    assertFalse("Broker is started", broker.isStarted());
}
Also used : BrokerService(org.apache.activemq.broker.BrokerService) URI(java.net.URI)

Example 79 with BrokerService

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

the class NetworkLoadTest method createBroker.

protected BrokerService createBroker(int brokerId) throws Exception {
    BrokerService broker = new BrokerService();
    broker.setBrokerName("broker-" + brokerId);
    broker.setPersistent(false);
    broker.setUseJmx(true);
    broker.getManagementContext().setCreateConnector(false);
    final SystemUsage memoryManager = new SystemUsage();
    // 50 MB
    memoryManager.getMemoryUsage().setLimit(1024 * 1024 * 50);
    broker.setSystemUsage(memoryManager);
    final List<PolicyEntry> policyEntries = new ArrayList<>();
    final PolicyEntry entry = new PolicyEntry();
    entry.setQueue(">");
    // Set to 1 MB
    entry.setMemoryLimit(1024 * 1024 * 1);
    entry.setPendingSubscriberPolicy(new VMPendingSubscriberMessageStoragePolicy());
    entry.setPendingQueuePolicy(new VMPendingQueueMessageStoragePolicy());
    policyEntries.add(entry);
    // This is to turn of the default behavior of storing topic messages for retroactive consumption
    final PolicyEntry topicPolicyEntry = new PolicyEntry();
    topicPolicyEntry.setTopic(">");
    final NoSubscriptionRecoveryPolicy noSubscriptionRecoveryPolicy = new NoSubscriptionRecoveryPolicy();
    topicPolicyEntry.setSubscriptionRecoveryPolicy(noSubscriptionRecoveryPolicy);
    final PolicyMap policyMap = new PolicyMap();
    policyMap.setPolicyEntries(policyEntries);
    broker.setDestinationPolicy(policyMap);
    TransportConnector transportConnector = new TransportConnector();
    transportConnector.setUri(new URI("tcp://localhost:" + (60000 + brokerId)));
    transportConnector.setDiscoveryUri(new URI("multicast://default?group=" + groupId));
    broker.addConnector(transportConnector);
    DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector();
    networkConnector.setUri(new URI("multicast://default?group=" + groupId));
    networkConnector.setBridgeTempDestinations(true);
    networkConnector.setPrefetchSize(1);
    broker.addNetworkConnector(networkConnector);
    return broker;
}
Also used : TransportConnector(org.apache.activemq.broker.TransportConnector) PolicyMap(org.apache.activemq.broker.region.policy.PolicyMap) VMPendingSubscriberMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingSubscriberMessageStoragePolicy) ArrayList(java.util.ArrayList) SystemUsage(org.apache.activemq.usage.SystemUsage) VMPendingQueueMessageStoragePolicy(org.apache.activemq.broker.region.policy.VMPendingQueueMessageStoragePolicy) BrokerService(org.apache.activemq.broker.BrokerService) PolicyEntry(org.apache.activemq.broker.region.policy.PolicyEntry) URI(java.net.URI) NoSubscriptionRecoveryPolicy(org.apache.activemq.broker.region.policy.NoSubscriptionRecoveryPolicy)

Example 80 with BrokerService

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

the class QueueBridgeStandaloneReconnectTest method createSecondBroker.

protected BrokerService createSecondBroker() throws Exception {
    BrokerService broker = new BrokerService();
    broker.setBrokerName("broker2");
    broker.setPersistent(false);
    broker.setUseJmx(false);
    broker.addConnector("tcp://localhost:61617");
    return broker;
}
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