Camel ActiveMQ + Spring boot not reading spring activemq configurations

前端 未结 1 1101
孤街浪徒
孤街浪徒 2021-01-13 07:08

I am trying a very simple route with Spring Boot 1.5.2.RELEASE + Camel (Spring Boot Starter) + ActiveMQ, which is to read from a particular queue and then log it. However, i

相关标签:
1条回答
  • 2021-01-13 08:01

    First you should add the spring-boot-starter-activemq dependency to your pom.xml. Then you can use its AutoConfiguration capabilities which will create a ConnectionFactory based on the properties you have specified in your application.yml.

    After that you have to configure Camel's ActiveMQComponent too. If you would like to reuse the ConnectionFactory (which created by the autoconfig) then it can be achievable with the following:

    @Configuration
    public class ActiveMQComponentConfig {
    
        @Bean(name = "activemq")
        public ActiveMQComponent createComponent(ConnectionFactory factory) {
            ActiveMQComponent activeMQComponent = new ActiveMQComponent();
            activeMQComponent.setConnectionFactory(factory);
            return activeMQComponent;
        }
    }
    

    You can find more information in Camel's ActiveMQ documentation.

    0 讨论(0)
提交回复
热议问题