Search in sources :

Example 1 with QueueConfiguration

use of org.apache.activemq.artemis.api.core.QueueConfiguration 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)

Aggregations

QueueConfiguration (org.apache.activemq.artemis.api.core.QueueConfiguration)1 CoreAddressConfiguration (org.apache.activemq.artemis.core.config.CoreAddressConfiguration)1 EmbeddedActiveMQ (org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ)1 JMSQueueConfiguration (org.apache.activemq.artemis.jms.server.config.JMSQueueConfiguration)1 TopicConfiguration (org.apache.activemq.artemis.jms.server.config.TopicConfiguration)1 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1