Search in sources :

Example 76 with AddressSettings

use of org.apache.activemq.artemis.core.settings.impl.AddressSettings in project activemq-artemis by apache.

the class RelativePathTest method testRelativePathOnDefaultConfig.

@Test
public void testRelativePathOnDefaultConfig() throws Exception {
    Configuration configuration = createDefaultConfig(false);
    ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<String, AddressSettings>());
    server.start();
    server.stop();
    checkData(new File(configuration.getJournalDirectory()), ".amq");
    checkData(new File(configuration.getBindingsDirectory()), ".bindings");
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) File(java.io.File) Test(org.junit.Test)

Example 77 with AddressSettings

use of org.apache.activemq.artemis.core.settings.impl.AddressSettings in project activemq-artemis by apache.

the class RelativePathTest method testRelativePath.

@Test
public void testRelativePath() throws Exception {
    Configuration configuration = createDefaultConfig(false);
    File instanceHome = new File(getTemporaryDir(), "artemisHome");
    File dataHome = new File(instanceHome, "data");
    // One folder up for testing
    File bindingsHome = new File(instanceHome, "../binx");
    System.out.println("InstanceHome->" + instanceHome);
    instanceHome.mkdirs();
    configuration.setBrokerInstance(instanceHome);
    configuration.setJournalDirectory("./data");
    configuration.setPagingDirectory("./paging");
    configuration.setBindingsDirectory("../binx");
    // one folder up from instance home
    configuration.setLargeMessagesDirectory("./large");
    ActiveMQServer server = createServer(true, configuration, AddressSettings.DEFAULT_PAGE_SIZE, AddressSettings.DEFAULT_MAX_SIZE_BYTES, new HashMap<String, AddressSettings>());
    server.start();
    server.stop();
    checkData(dataHome, ".amq");
    checkData(bindingsHome, ".bindings");
}
Also used : ActiveMQServer(org.apache.activemq.artemis.core.server.ActiveMQServer) AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) File(java.io.File) Test(org.junit.Test)

Example 78 with AddressSettings

use of org.apache.activemq.artemis.core.settings.impl.AddressSettings in project activemq-artemis by apache.

the class DuplicateRecordIdTest method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    server = createServer(false, createDefaultInVMConfig().addAddressesSetting("#", new AddressSettings().setDeadLetterAddress(new SimpleString("dlq")).setExpiryAddress(new SimpleString("dlq"))));
    server.getConfiguration().setPersistenceEnabled(true);
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) Before(org.junit.Before)

Example 79 with AddressSettings

use of org.apache.activemq.artemis.core.settings.impl.AddressSettings in project activemq-artemis by apache.

the class ExpireWhileLoadBalanceTest method testSend.

@Test
public void testSend() throws Exception {
    waitForTopology(getServer(0), 3);
    waitForTopology(getServer(1), 3);
    waitForTopology(getServer(2), 3);
    SimpleString expiryQueue = SimpleString.toSimpleString("expiryQueue");
    AddressSettings as = new AddressSettings();
    as.setDeadLetterAddress(expiryQueue);
    as.setExpiryAddress(expiryQueue);
    for (int i = 0; i <= 2; i++) {
        createQueue(i, "queues.testaddress", "queue0", null, true);
        getServer(i).createQueue(expiryQueue, RoutingType.ANYCAST, expiryQueue, null, true, false);
        getServer(i).getAddressSettingsRepository().addMatch("#", as);
    }
    // this will pause all the cluster bridges
    for (ClusterConnection clusterConnection : getServer(0).getClusterManager().getClusterConnections()) {
        for (MessageFlowRecord record : ((ClusterConnectionImpl) clusterConnection).getRecords().values()) {
            record.getBridge().pause();
        }
    }
    ClientSessionFactory sf = sfs[0];
    ClientSession session = sf.createSession(false, false);
    ClientProducer producer = session.createProducer("queues.testaddress");
    for (int i = 0; i < 1000; i++) {
        ClientMessage message = session.createMessage(true);
        message.setExpiration(500);
        producer.send(message);
    }
    session.commit();
    session.start();
    ClientConsumer consumer = session.createConsumer("expiryQueue");
    for (int i = 0; i < 1000; i++) {
        ClientMessage message = consumer.receive(2000);
        Assert.assertNotNull(message);
        message.acknowledge();
    }
    session.commit();
    session.close();
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) MessageFlowRecord(org.apache.activemq.artemis.core.server.cluster.MessageFlowRecord) ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) ClientSession(org.apache.activemq.artemis.api.core.client.ClientSession) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ClientSessionFactory(org.apache.activemq.artemis.api.core.client.ClientSessionFactory) ClientMessage(org.apache.activemq.artemis.api.core.client.ClientMessage) ClientConsumer(org.apache.activemq.artemis.api.core.client.ClientConsumer) ClientProducer(org.apache.activemq.artemis.api.core.client.ClientProducer) Test(org.junit.Test)

Example 80 with AddressSettings

use of org.apache.activemq.artemis.core.settings.impl.AddressSettings in project activemq-artemis by apache.

the class MessageRedistributionWithDiscoveryTest method setServer.

/**
 * @param messageLoadBalancingType
 * @throws Exception
 */
protected void setServer(final MessageLoadBalancingType messageLoadBalancingType, int server) throws Exception {
    setupLiveServerWithDiscovery(server, groupAddress, groupPort, isFileStorage(), isNetty(), false);
    AddressSettings setting = new AddressSettings().setRedeliveryDelay(0).setRedistributionDelay(0);
    servers[server].getAddressSettingsRepository().addMatch("#", setting);
    setupDiscoveryClusterConnection("cluster" + server, server, "dg1", "queues", messageLoadBalancingType, 1, isNetty());
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings)

Aggregations

AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)273 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)162 Test (org.junit.Test)161 ClientMessage (org.apache.activemq.artemis.api.core.client.ClientMessage)103 ClientProducer (org.apache.activemq.artemis.api.core.client.ClientProducer)103 ClientConsumer (org.apache.activemq.artemis.api.core.client.ClientConsumer)88 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)81 ClientSessionFactory (org.apache.activemq.artemis.api.core.client.ClientSessionFactory)65 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)54 Configuration (org.apache.activemq.artemis.core.config.Configuration)52 HashMap (java.util.HashMap)31 ServerLocator (org.apache.activemq.artemis.api.core.client.ServerLocator)30 Queue (org.apache.activemq.artemis.core.server.Queue)24 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)21 Before (org.junit.Before)19 Session (javax.jms.Session)18 Message (org.apache.activemq.artemis.api.core.Message)18 ArrayList (java.util.ArrayList)15 PagingStore (org.apache.activemq.artemis.core.paging.PagingStore)15 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)14