Search in sources :

Example 41 with ConfigurationImpl

use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project narayana by jbosstm.

the class JmsHelper method getCoreConfiguration.

private Configuration getCoreConfiguration() {
    Configuration configuration = new ConfigurationImpl();
    configuration.setPersistenceEnabled(false);
    configuration.setJournalDirectory("target/data/journal");
    configuration.setSecurityEnabled(false);
    configuration.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    configuration.getConnectorConfigurations().put("connector", new TransportConfiguration(InVMConnectorFactory.class.getName()));
    return configuration;
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) JMSConfiguration(org.apache.activemq.artemis.jms.server.config.JMSConfiguration) ConnectionFactoryConfiguration(org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration) JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ConnectionFactoryConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) JMSQueueConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl)

Example 42 with ConfigurationImpl

use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project wildfly by wildfly.

the class ArtemisRunListener method startServer.

private synchronized ActiveMQServer startServer() throws Exception {
    if (server == null) {
        Configuration config = new ConfigurationImpl().setName("Test-Broker").addAcceptorConfiguration("netty", getBrokerUrl()).setSecurityEnabled(false).setPersistenceEnabled(false).setJournalFileSize(10 * 1024 * 1024).setJournalDeviceBlockSize(4096).setJournalMinFiles(2).setJournalDatasync(true).setJournalPoolFiles(10).addConnectorConfiguration("netty", getBrokerUrl());
        File dataPlace = new File(getArtemisHome());
        FileUtil.deleteDirectory(dataPlace);
        config.setJournalDirectory(new File(dataPlace, "./journal").getAbsolutePath()).setPagingDirectory(new File(dataPlace, "./paging").getAbsolutePath()).setLargeMessagesDirectory(new File(dataPlace, "./largemessages").getAbsolutePath()).setBindingsDirectory(new File(dataPlace, "./bindings").getAbsolutePath()).setPersistenceEnabled(true);
        server = ActiveMQServers.newActiveMQServer(config, PERSISTENCE);
        server.getAddressSettingsRepository().addMatch("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")).setRedeliveryDelay(0).setMaxSizeBytes(-1).setMessageCounterHistoryDayLimit(10).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setAutoCreateQueues(true).setAutoCreateAddresses(true).setAutoCreateJmsQueues(true).setAutoCreateJmsTopics(true));
        server.getAddressSettingsRepository().addMatch("activemq.management#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")).setRedeliveryDelay(0).setMaxSizeBytes(-1).setMessageCounterHistoryDayLimit(10).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE).setAutoCreateQueues(true).setAutoCreateAddresses(true).setAutoCreateJmsQueues(true).setAutoCreateJmsTopics(true));
        server.start();
        server.waitForActivation(10, TimeUnit.SECONDS);
    }
    return server;
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) File(java.io.File)

Example 43 with ConfigurationImpl

use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project spring-boot by spring-projects.

the class ArtemisEmbeddedConfigurationFactory method createConfiguration.

Configuration createConfiguration() {
    ConfigurationImpl configuration = new ConfigurationImpl();
    configuration.setSecurityEnabled(false);
    configuration.setPersistenceEnabled(this.properties.isPersistent());
    String dataDir = getDataDir();
    configuration.setJournalDirectory(dataDir + "/journal");
    if (this.properties.isPersistent()) {
        configuration.setJournalType(JournalType.NIO);
        configuration.setLargeMessagesDirectory(dataDir + "/largemessages");
        configuration.setBindingsDirectory(dataDir + "/bindings");
        configuration.setPagingDirectory(dataDir + "/paging");
    }
    TransportConfiguration transportConfiguration = new TransportConfiguration(InVMAcceptorFactory.class.getName(), this.properties.generateTransportParameters());
    configuration.getAcceptorConfigurations().add(transportConfiguration);
    if (this.properties.isDefaultClusterPassword() && logger.isDebugEnabled()) {
        logger.debug("Using default Artemis cluster password: " + this.properties.getClusterPassword());
    }
    configuration.setClusterPassword(this.properties.getClusterPassword());
    configuration.addAddressConfiguration(createAddressConfiguration("DLQ"));
    configuration.addAddressConfiguration(createAddressConfiguration("ExpiryQueue"));
    configuration.addAddressesSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")));
    return configuration;
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) InVMAcceptorFactory(org.apache.activemq.artemis.core.remoting.impl.invm.InVMAcceptorFactory)

Example 44 with ConfigurationImpl

use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project scout.rt by eclipse.

the class ArtemisJmsBrokerTestRule method createArtemisServerConfig.

protected Configuration createArtemisServerConfig() {
    Configuration config = new ConfigurationImpl();
    config.setSecurityEnabled(false);
    config.addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName()));
    config.addAddressesSetting("#", new AddressSettings().setExpiryAddress(new SimpleString("jms.queue.ExpiryQueue")).setDeadLetterAddress(new SimpleString("jms.queue.DLQ")));
    config.addQueueConfiguration(createQueue("jms.topic.scout.mom.requestreply.cancellation"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicPublishFirst"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testProperties"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReplyTimeout"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReplyRequestFirst"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReplyMultipleSubscriptions"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReplyCorrelationId"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicPublishSubscribeMultipleSubscriptions"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testQueueRequestReplyJsonObjectMarshaller"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReplyCancellation"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicRequestReply"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testTopicPublishSubscribeCorrelationId"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testMessageSelector"));
    config.addQueueConfiguration(createQueue("jms.topic.test/mom/testQueueRequestReplyCancellation"));
    config.addQueueConfiguration(createQueue("jms.topic.differentTopic"));
    config.addQueueConfiguration(createQueue("jms.topic.scout.physical.UnitTestTopic"));
    config.addQueueConfiguration(createQueue("Durable-Test-Subscription").setAddress("jms.topic.test/mom/testTopicPublishSubscribe"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishBytes"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishText"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishObject"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testConcurrentMessageConsumption"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishAndConsumeInternal"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testSubscribeTransactional"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testQueuePublishFirst"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishJsonData"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishJsonDataSecure"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testQueueRequestReplyRequestFirst"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishTransactional"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishStringData"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testPublishObjectData"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testCurrentMessagePubSub"));
    config.addQueueConfiguration(createQueue("jms.queue.test/mom/testSerialMessageConsumption"));
    return config;
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) Configuration(org.apache.activemq.artemis.core.config.Configuration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)

Example 45 with ConfigurationImpl

use of org.apache.activemq.artemis.core.config.impl.ConfigurationImpl in project dhis2-core by dhis2.

the class ArtemisConfig method createEmbeddedServer.

@Bean
public EmbeddedActiveMQ createEmbeddedServer(ArtemisConfigData artemisConfigData) throws Exception {
    EmbeddedActiveMQ server = new EmbeddedActiveMQ();
    org.apache.activemq.artemis.core.config.Configuration config = new ConfigurationImpl();
    ArtemisEmbeddedConfig embeddedConfig = artemisConfigData.getEmbedded();
    config.addAcceptorConfiguration("in-vm", String.format("vm://0?jms.useAsyncSend=%s&nioRemotingThreads=%d", artemisConfigData.isSendAsync(), embeddedConfig.getNioRemotingThreads()));
    config.setSecurityEnabled(embeddedConfig.isSecurity());
    config.setPersistenceEnabled(embeddedConfig.isPersistence());
    if (locationManager.externalDirectorySet() && embeddedConfig.isPersistence()) {
        String dataDir = locationManager.getExternalDirectoryPath();
        config.setJournalDirectory(dataDir + "/artemis/journal");
        config.setJournalType(JournalType.NIO);
        config.setLargeMessagesDirectory(dataDir + "/artemis/largemessages");
        config.setBindingsDirectory(dataDir + "/artemis/bindings");
        config.setPagingDirectory(dataDir + "/artemis/paging");
    }
    config.addAddressesSetting("#", new AddressSettings().setDeadLetterAddress(SimpleString.toSimpleString("DLQ")).setExpiryAddress(SimpleString.toSimpleString("ExpiryQueue")));
    config.addAddressConfiguration(new CoreAddressConfiguration().setName("DLQ").addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new CoreQueueConfiguration().setName("DLQ").setRoutingType(RoutingType.ANYCAST)));
    config.addAddressConfiguration(new CoreAddressConfiguration().setName("ExpiryQueue").addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new CoreQueueConfiguration().setName("ExpiryQueue").setRoutingType(RoutingType.ANYCAST)));
    server.setConfiguration(config);
    return server;
}
Also used : AddressSettings(org.apache.activemq.artemis.core.settings.impl.AddressSettings) CoreAddressConfiguration(org.apache.activemq.artemis.core.config.CoreAddressConfiguration) CoreQueueConfiguration(org.apache.activemq.artemis.core.config.CoreQueueConfiguration) SimpleString(org.apache.activemq.artemis.api.core.SimpleString) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) EmbeddedActiveMQ(org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConfigurationImpl (org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)45 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)26 Configuration (org.apache.activemq.artemis.core.config.Configuration)21 AddressSettings (org.apache.activemq.artemis.core.settings.impl.AddressSettings)13 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)12 Before (org.junit.Before)12 HashMap (java.util.HashMap)11 ActiveMQJAASSecurityManager (org.apache.activemq.artemis.spi.core.security.ActiveMQJAASSecurityManager)7 File (java.io.File)5 JMSConfigurationImpl (org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl)5 HashSet (java.util.HashSet)4 InVMConnectorFactory (org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnectorFactory)4 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)3 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)3 JournalStorageManager (org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager)3 Role (org.apache.activemq.artemis.core.security.Role)3 OrderedExecutorFactory (org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory)3 Test (org.junit.Test)3 Set (java.util.Set)2 ActiveMQDefaultConfiguration (org.apache.activemq.artemis.api.config.ActiveMQDefaultConfiguration)2