【发布时间】:2019-09-17 22:30:31
【问题描述】:
我正在尝试将我的 spring 应用程序设置为侦听 JMS 队列。 我尝试在我的 application.yml 中设置代理 URL,但它似乎总是默认为“localhost:61616”。 application.yml 文件是从另一个应用程序加载的,但我认为这并不重要,因为读取了文件中的其他属性(例如队列的名称)
这是我收到的消息:
o.a.a.t.failover.FailoverTransport;Failed to connect to [tcp://localhost:61616] after: 40 attempt(s) continuing to retry.
我尝试了什么
我已尝试遵循此问题的答案:Camel ActiveMQ + Spring boot not reading spring activemq configurations 这是我的确切问题
但是当我尝试添加依赖项并创建该类时,我得到了这个错误:
Parameter 0 of method createComponent in xxx.xxxxx.xxxx.configuration.ActiveMQComponentConfig required a bean of type 'javax.jms.ConnectionFactory' that could not be found.
我对 Spring boot / ActiveMQ 还很陌生,我真的不知道该怎么做。
这是我的 pom.xml 的相关部分
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.3.RELEASE</version>
<relativePath />
</parent>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring-boot-starter</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-broker</artifactId>
</exclusion>
</exclusions>
</dependency>
还有我的 application.yml :
spring:
aop:
proxy-target-class: true
cache:
ehcache:
config: classpath:ehcache.xml
activemq:
broker-url: tcp://foo:12345
pool:
enabled: true
max-connections: 5
任何帮助将不胜感激,我已经花了相当多的时间在这方面,但没有取得任何进展
【问题讨论】:
-
在github.com/apache/camel/tree/master/examples/… 有一个小骆驼 activemq 示例,可能会有所帮助
-
现在我已经通过为 activemq 创建自己的配置而不是依赖 Spring boot 的配置来绕过这一点。到目前为止似乎工作,但它不是最佳的,所以我明天会检查那个例子,谢谢!
-
你能说说你自己是怎么做到的吗?
-
@Arun 我会用它来回答的
标签: spring-boot apache-camel yaml activemq