Search in sources :

Example 81 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class SessionFactoryTest method startServer.

private void startServer() throws Exception {
    liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY);
    final long broadcastPeriod = 250;
    final String bcGroupName = "bc1";
    final int localBindPort = 5432;
    BroadcastGroupConfiguration broadcastGroupConfiguration = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(Arrays.asList(liveTC.getName())).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()).setLocalBindPort(localBindPort));
    Configuration liveConf = createDefaultInVMConfig().addConnectorConfiguration(liveTC.getName(), liveTC).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()).addBroadcastGroupConfiguration(broadcastGroupConfiguration);
    liveService = createServer(false, liveConf);
    liveService.start();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SharedStoreMasterPolicyConfiguration(org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) BroadcastGroupConfiguration(org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)

Example 82 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class RedeliveryConsumerTest method setUp.

// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
/**
 * @param persistDeliveryCountBeforeDelivery
 * @throws Exception
 */
private void setUp(final boolean persistDeliveryCountBeforeDelivery) throws Exception {
    Configuration config = createDefaultInVMConfig().setPersistDeliveryCountBeforeDelivery(persistDeliveryCountBeforeDelivery);
    server = createServer(true, config);
    server.start();
    locator = createInVMNonHALocator();
    factory = createSessionFactory(locator);
    ClientSession session = addClientSession(factory.createSession(false, false, false));
    try {
        session.createQueue(ADDRESS, ADDRESS, true);
    } catch (ActiveMQException expected) {
    // in case of restart
    }
    session.close();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession)

Example 83 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class SendAckFailTest method startServer.

public ActiveMQServer startServer(boolean fail) {
    try {
        // ActiveMQServerImpl server = (ActiveMQServerImpl) createServer(true, true);
        AtomicInteger count = new AtomicInteger(0);
        ActiveMQSecurityManager securityManager = new ActiveMQJAASSecurityManager(InVMLoginModule.class.getName(), new SecurityConfiguration());
        Configuration configuration = createDefaultConfig(true);
        ActiveMQServer server = new ActiveMQServerImpl(configuration, ManagementFactory.getPlatformMBeanServer(), securityManager) {

            @Override
            public StorageManager createStorageManager() {
                StorageManager original = super.createStorageManager();
                return new StorageManagerDelegate(original) {

                    @Override
                    public void storeMessage(Message message) throws Exception {
                        if (fail) {
                            if (count.incrementAndGet() == 110) {
                                System.out.println("Failing " + message);
                                System.out.flush();
                                Thread.sleep(100);
                                Runtime.getRuntime().halt(-1);
                            }
                        }
                        super.storeMessage(message);
                    }
                };
            }
        };
        System.out.println("Location::" + server.getConfiguration().getJournalLocation().getAbsolutePath());
        server.start();
        return server;
    } catch (Exception e) {
        e.printStackTrace();
        return null;
    }
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) Configuration(org.apache.activemq.artemis.core.config.Configuration) SecurityConfiguration(org.apache.activemq.artemis.core.config.impl.SecurityConfiguration) LargeServerMessage(org.apache.activemq.artemis.core.server.LargeServerMessage) PagedMessage(org.apache.activemq.artemis.core.paging.PagedMessage) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) Message(org.apache.activemq.artemis.api.core.Message) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ActiveMQJAASSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager) StorageManager(org.apache.activemq.artemis.core.persistence.StorageManager) InVMLoginModule(org.apache.activemq.artemis.spi.core.security.jaas.InVMLoginModule) SecurityConfiguration(org.apache.activemq.artemis.core.config.impl.SecurityConfiguration) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) ActiveMQSecurityManager(org.apache.activemq.artemis.spi.core.security.ActiveMQSecurityManager)

Example 84 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class ServerLocatorConnectTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Configuration configuration = createDefaultConfig(isNetty());
    server = createServer(false, configuration);
    server.start();
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) Before(org.junit.Before)

Example 85 with Configuration

use of org.apache.activemq.artemis.core.config.Configuration in project activemq-artemis by apache.

the class WildCardRoutingTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    Configuration configuration = createDefaultInVMConfig().setWildcardRoutingEnabled(true).setTransactionTimeoutScanPeriod(500);
    server = addServer(ActiveMQServers.newActiveMQServer(configuration, false));
    server.start();
    server.getManagementService().enableNotifications(false);
    locator = createInVMNonHALocator();
    sf = createSessionFactory(locator);
    clientSession = addClientSession(sf.createSession(false, true, true));
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) Before(org.junit.Before)

Aggregations

Configuration (org.apache.activemq.artemis.core.config.Configuration)331 Test (org.junit.Test)143 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)120 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)109 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)108 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)101 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)93 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)90 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)81 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)78 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)78 DivertConfiguration (org.apache.activemq.artemis.core.config.DivertConfiguration)72 Before (org.junit.Before)59 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)58 DatabaseStorageConfiguration (org.apache.activemq.artemis.core.config.storage.DatabaseStorageConfiguration)57 HashMap (java.util.HashMap)56 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)52 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)35 SharedStoreMasterPolicyConfiguration (org.apache.activemq.artemis.core.config.ha.SharedStoreMasterPolicyConfiguration)35 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)34