Search in sources :

Example 6 with JMSQueueConfiguration

use of org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration in project spring-boot by spring-projects.

the class ArtemisEmbeddedServerConfiguration method embeddedActiveMq.

@Bean(initMethod = "start", destroyMethod = "stop")
@ConditionalOnMissingBean
EmbeddedActiveMQ embeddedActiveMq(org.apache.activemq.artemis.core.config.Configuration configuration, JMSConfiguration jmsConfiguration, ObjectProvider<ArtemisConfigurationCustomizer> configurationCustomizers) throws Exception {
    for (JMSQueueConfiguration queueConfiguration : jmsConfiguration.getQueueConfigurations()) {
        String queueName = queueConfiguration.getName();
        configuration.addAddressConfiguration(new CoreAddressConfiguration().setName(queueName).addRoutingType(RoutingType.ANYCAST).addQueueConfiguration(new QueueConfiguration(queueName).setAddress(queueName).setFilterString(queueConfiguration.getSelector()).setDurable(queueConfiguration.isDurable()).setRoutingType(RoutingType.ANYCAST)));
    }
    for (TopicConfiguration topicConfiguration : jmsConfiguration.getTopicConfigurations()) {
        configuration.addAddressConfiguration(new CoreAddressConfiguration().setName(topicConfiguration.getName()).addRoutingType(RoutingType.MULTICAST));
    }
    configurationCustomizers.orderedStream().forEach((customizer) -> customizer.customize(configuration));
    EmbeddedActiveMQ embeddedActiveMq = new EmbeddedActiveMQ();
    embeddedActiveMq.setConfiguration(configuration);
    return embeddedActiveMq;
}
Also used : JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) QueueConfiguration(org.apache.activemq.artemis.api.core.QueueConfiguration) JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) CoreAddressConfiguration(org.apache.activemq.artemis.core.config.CoreAddressConfiguration) TopicConfiguration(org.apache.activemq.artemis.jms.server.config.TopicConfiguration) EmbeddedActiveMQ(org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Example 7 with JMSQueueConfiguration

use of org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration in project camel by apache.

the class Jms2TestSupport method configureBroker.

protected void configureBroker(EmbeddedJMS broker) throws Exception {
    Configuration configuration = new ConfigurationImpl().setPersistenceEnabled(false).setJournalDirectory("target/data/journal").setSecurityEnabled(false).addAcceptorConfiguration("connector", brokerUri + "?protocols=CORE,AMQP,HORNETQ,OPENWIRE").addAcceptorConfiguration("vm", "vm://broker").addConnectorConfiguration("connector", new TransportConfiguration(NettyConnectorFactory.class.getName()));
    JMSConfiguration jmsConfig = new JMSConfigurationImpl();
    ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(Arrays.asList("connector")).setBindings("cf");
    jmsConfig.getConnectionFactoryConfigurations().add(cfConfig);
    JMSQueueConfiguration queueConfig = new JMSQueueConfigurationImpl().setName("queue1").setDurable(false).setBindings("queue/queue1");
    jmsConfig.getQueueConfigurations().add(queueConfig);
    broker.setConfiguration(configuration).setJmsConfiguration(jmsConfig);
}
Also used : JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) JMSConfiguration(org.apache.activemq.artemis.jms.server.config.JMSConfiguration) Configuration(org.apache.activemq.artemis.core.config.Configuration) ConnectionFactoryConfiguration(org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration) JMSQueueConfiguration(org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration) JMSConfiguration(org.apache.activemq.artemis.jms.server.config.JMSConfiguration) 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) JMSQueueConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl) TransportConfiguration(org.apache.activemq.artemis.api.core.TransportConfiguration) JMSConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSConfigurationImpl) ConfigurationImpl(org.apache.activemq.artemis.core.config.impl.ConfigurationImpl) ConnectionFactoryConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl) JMSQueueConfigurationImpl(org.apache.activemq.artemis.jms.server.config.impl.JMSQueueConfigurationImpl) ConnectionFactoryConfiguration(org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration)

Aggregations

JMSQueueConfiguration (org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration)7 TopicConfiguration (org.apache.activemq.artemis.jms.server.config.TopicConfiguration)5 ArrayList (java.util.ArrayList)2 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)2 Configuration (org.apache.activemq.artemis.core.config.Configuration)2 CoreAddressConfiguration (org.apache.activemq.artemis.core.config.CoreAddressConfiguration)2 FileDeploymentManager (org.apache.activemq.artemis.core.config.FileDeploymentManager)2 ConnectionFactoryConfiguration (org.apache.activemq.artemis.jms.server.config.ConnectionFactoryConfiguration)2 FileJMSConfiguration (org.apache.activemq.artemis.jms.server.config.impl.FileJMSConfiguration)2 URI (java.net.URI)1 List (java.util.List)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 WebApplicationException (javax.ws.rs.WebApplicationException)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 QueueConfiguration (org.apache.activemq.artemis.api.core.QueueConfiguration)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 ClientSession (org.apache.activemq.artemis.api.core.client.ClientSession)1 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)1 ConfigurationImpl (org.apache.activemq.artemis.core.config.impl.ConfigurationImpl)1