我正在使用DSL构建异步队列处理器。
路线代码如下所示:
from("seda://exportListQueue")
.setProperty("originalRequest", simple("${body}"))
.setHeader("CamelRedis.Key", Builder.simple("Something"))
.setHeader("CamelRedis.Value", Builder.simple("Some Json"))
.to("spring-redis://the_host:the_port?serializer=#stringSerializer") .setBody(exchangeProperty("originalRequest").convertTo(MyClass::class.java))
.process(queueProcessor)
.to("http4:some_url)
(这是科特琳·顺便说一句,但这没关系)
当然,我已经更改了名称,因为我无法公开非通用部分。我的问题是,当我尝试运行应用程序时,骆驼立即停止。日志是这样的:
[INFO ] [2019-04-01 18:57:46,089] [] [] [o.a.c.l.i.Jdk14Logger->log:87] | Detected @ExceptionHandler methods in exceptionHandlerController
[INFO ] [2019-04-01 18:57:46,995] [] [] [o.a.c.l.i.Jdk14Logger->log:87] | Registering beans for JMX exposure on startup
[INFO ] [2019-04-01 18:57:46,998] [] [] [o.a.c.l.i.Jdk14Logger->log:87] | Bean with name 'dataSource' has been autodetected for JMX exposure
[INFO ] [2019-04-01 18:57:47,010] [] [] [o.a.c.l.i.Jdk14Logger->log:87] | Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
[INFO ] [2019-04-01 18:57:47,079] [] [] [o.a.c.s.b.RoutesCollector->loadXmlRoutes:279] | Loading additional Camel XML routes from: classpath:camel/*.xml
[INFO ] [2019-04-01 18:57:47,080] [] [] [o.a.c.s.b.RoutesCollector->loadXmlRests:296] | Loading additional Camel XML rests from: classpath:camel-rest/*.xml
[INFO ] [2019-04-01 18:57:47,084] [] [] [o.a.c.i.DefaultCamelContext->start:3138] | Apache Camel 2.23.1 (CamelContext: RED) is starting
[INFO ] [2019-04-01 18:57:47,085] [] [] [o.a.c.i.DefaultCamelContext->doStartCamel:3312] | MDC logging is enabled on CamelContext: RED
[INFO ] [2019-04-01 18:57:47,085] [] [] [o.a.c.m.ManagedManagementStrategy->doStart:205] | JMX is enabled
[INFO ] [2019-04-01 18:57:47,249] [] [] [o.a.c.i.DefaultCamelContext->doStop:3496] | Apache Camel 2.23.1 (CamelContext: RED) is shutting down
[INFO ] [2019-04-01 18:57:47,256] [] [] [o.a.c.i.DefaultCamelContext->doStop:3596] | Apache Camel 2.23.1 (CamelContext: RED) uptime 0.171 seconds
[INFO ] [2019-04-01 18:57:47,256] [] [] [o.a.c.i.DefaultCamelContext->doStop:3597] | Apache Camel 2.23.1 (CamelContext: RED) is shutdown in 0.007 seconds
以跟踪级别进行记录,我们找到问题的根源:
[TRACE] [2019-04-01 19:01:06,419] [] [] [o.a.c.u.EventHelper->doNotifyEvent:1091] | Notifier: org.apache.camel.spring.boot.RoutesCollector$2@7dd847a2 is not enabled for the event: Failed to start Camel: RED due to Failed to create route route1 at: >>> To[spring-redis://the_port:the_host?serializer=#stringSerializer] <<< in route: Route(route1)[[From[seda://exporQueue]] -> [SetProperty... because of Failed to resolve endpoint: spring-redis://the_host:the_port?serializer=%23stringSerializer due to: No component found with scheme: spring-redis
最后,这只是缺少的依赖项。但是我的问题是,难道骆驼不应该给我一个例外,或者至少是一个警告,告诉它为什么以更友好的方式关闭。
我错过了什么吗,或者真的是一个不漂亮的骆驼行为,应该得到罚单吗?
---编辑---
这是与启动相关的依赖项
dependencies {
// spring web
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-jetty")
// cache
compile("org.springframework.boot:spring-boot-starter-cache")
// spring retry
compile("org.springframework.retry:spring-retry:1.1.5.RELEASE")
// monitoring
compile("org.springframework.boot:spring-boot-starter-actuator")
compile("org.springframework.boot:spring-boot-starter-logging")
// camel
compile('org.apache.camel:camel-spring-boot-starter:2.23.1')
compile('org.apache.camel:camel-spring-redis:2.23.1')
compile('org.apache.camel:camel-http4:2.23.1')
// eaio uuid
compile("com.eaio.uuid:uuid:3.2")
// apache
compile("org.apache.commons:commons-lang3:3.7")
compile("commons-codec:commons-codec:1.11")
compile("org.apache.httpcomponents:httpclient:4.5.3")
}