Hi
Juste doing some testing on boot+activemq with camel version 2.19.0
It seems that when you set the spring property spring.activemq.broker-url it
will not be set on the amq connectinfactory when using autoconfig.
A simple test class as
@SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Component
static class Route extends RouteBuilder {
@Override
public void configure() throws Exception {
from("activemq:foo")
.to("mock:bar");
}
}
}
with an application.properties ->
spring.activemq.broker-url=tcp://foo:61616
will start up and connect to localhost on amq default port ->
2017-05-20 18:15:42.745 INFO 73341 --- [ main]
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public
org.springframework.http.ResponseEntity<java.util.Map<java.lang.String,
java.lang.Object>>
org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2017-05-20 18:15:42.746 INFO 73341 --- [ main]
s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped
"{[/error],produces=[text/html]}" onto public
org.springframework.web.servlet.ModelAndView
org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2017-05-20 18:15:42.786 INFO 73341 --- [ main]
o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**]
onto handler of type [class
org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-05-20 18:15:42.786 INFO 73341 --- [ main]
o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto
handler of type [class
org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-05-20 18:15:42.840 INFO 73341 --- [ main]
o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico]
onto handler of type [class
org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2017-05-20 18:15:43.565 INFO 73341 --- [ main]
o.a.c.i.converter.DefaultTypeConverter : Loaded 196 type converters
2017-05-20 18:15:44.224 INFO 73341 --- [ main]
o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX
exposure on startup
2017-05-20 18:15:44.236 INFO 73341 --- [ main]
o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase
2147483647
2017-05-20 18:15:44.289 INFO 73341 --- [ main]
o.a.camel.spring.boot.RoutesCollector : Loading additional Camel XML
routes from: classpath:camel/*.xml
2017-05-20 18:15:44.289 INFO 73341 --- [ main]
o.a.camel.spring.boot.RoutesCollector : Loading additional Camel XML
rests from: classpath:camel-rest/*.xml
2017-05-20 18:15:44.290 INFO 73341 --- [ main]
o.a.camel.spring.SpringCamelContext : Apache Camel 2.19.0
(CamelContext: camel-1) is starting
2017-05-20 18:15:44.291 INFO 73341 --- [ main]
o.a.c.m.ManagedManagementStrategy : JMX is enabled
2017-05-20 18:15:44.421 INFO 73341 --- [ main]
o.a.c.i.DefaultRuntimeEndpointRegistry : Runtime endpoint registry is in
extended mode gathering usage statistics of all incoming and outgoing
endpoints (cache limit: 1000)
2017-05-20 18:15:44.586 INFO 73341 --- [ main]
o.a.camel.spring.SpringCamelContext : StreamCaching is not in use. If
using streams then its recommended to enable stream caching. See more
details at http://camel.apache.org/stream-caching.html
2017-05-20 18:15:50.004 WARN 73341 --- [ActiveMQ Task-1]
o.a.a.t.failover.FailoverTransport : Failed to connect to
[tcp://localhost:61616] after: 10 attempt(s) continuing to retry.
Besides that it's not any clean way to stop the application since the
FailoverTransport thread seems to block the shutdown process. Killing the
process is the only way.
When I override the managed activemq-camel version, and downgrade to 5.14.0
it works as expected.
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-camel</artifactId>
<version>5.14.0</version>
console output ->
2017-05-20 18:22:15.436 INFO 73360 --- [ main]
com.example.demo.DemoApplication : Started DemoApplication in 4.757
seconds (JVM running for 5.247)
2017-05-20 18:22:20.379 INFO 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : JMS message listener invoker
needs to establish shared Connection
2017-05-20 18:22:20.382 ERROR 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : Could not refresh JMS Connection
for destination 'foo' - retrying using FixedBackOff{interval=5000,
currentAttempts=0, maxAttempts=unlimited}. Cause: Could not connect to
broker URL: tcp://foo:61616. Reason: java.net.UnknownHostException: foo
2017-05-20 18:22:25.385 ERROR 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : Could not refresh JMS Connection
for destination 'foo' - retrying using FixedBackOff{interval=5000,
currentAttempts=1, maxAttempts=unlimited}. Cause: Could not connect to
broker URL: tcp://foo:61616. Reason: java.net.UnknownHostException: foo
2017-05-20 18:22:30.392 ERROR 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : Could not refresh JMS Connection
for destination 'foo' - retrying using FixedBackOff{interval=5000,
currentAttempts=2, maxAttempts=unlimited}. Cause: Could not connect to
broker URL: tcp://foo:61616. Reason: java.net.UnknownHostException: foo
2017-05-20 18:22:35.397 ERROR 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : Could not refresh JMS Connection
for destination 'foo' - retrying using FixedBackOff{interval=5000,
currentAttempts=3, maxAttempts=unlimited}. Cause: Could not connect to
broker URL: tcp://foo:61616. Reason: java.net.UnknownHostException: foo
2017-05-20 18:22:40.402 ERROR 73360 --- [msConsumer[foo]]
c.c.j.DefaultJmsMessageListenerContainer : Could not refresh JMS Connection
for destination 'foo' - retrying using FixedBackOff{interval=5000,
currentAttempts=4, maxAttempts=unlimited}. Cause: Could not connect to
broker URL: tcp://foo:61616. Reason: java.net.UnknownHostException: foo
/preben
--
View this message in context:
http://camel.465427.n5.nabble.com/spring-activemq-broker-url-not-set-correct-on-Activemq-Spring-Boot-tp5799927.html
Sent from the Camel - Users mailing list archive at Nabble.com.