【发布时间】:2017-02-12 15:30:07
【问题描述】:
前提条件:
骆驼 2.17
我已经定义了一些路由,这些路由包含如下条目:
.to ("log:org.apache.camel?level=DEBUG")
我的 logback 配置包含:
<logger name="org.apache.camel" level="TRACE" />
上下文定义开始于:
<camel:camelContext id="someContext" ... trace="true">
当我启动 Camel 时,我看到 Camel 正在继续,最后没有 ANY 错误报告只是关闭。这看起来像:
2016-10-04 13:40:56,146 [localhost-startStop-1] TRACE org.apache.camel.model.ProcessorDefinitionHelper - There are 6 properties on: From[direct:process]
2016-10-04 13:40:58,042 [localhost-startStop-1] DEBUG org.apache.camel.spring.SpringCamelContext - onApplicationEvent: org.springframework.context.event.ContextClosedEvent[source=Root WebApplicationContext: startup date [Tue Oct 04 13:37:25 CEST 2016]; root of context hierarchy]
2016-10-04 13:40:58,066 [localhost-startStop-1] INFO org.apache.camel.spring.SpringCamelContext - Apache Camel 2.17.3 (CamelContext: someContext) is shutting down
我也有:
onException( java.lang.Exception.class )
.handled( false )
.to( "log:GeneralError?level=ERROR" );
但这更多的是与交换处理有关,而不是与启动有关。
有没有通用的方法来检查那里发生了什么? 例如:
- 是否缺少任何类并且类加载器失败?
- 或者是否抛出任何异常?
- 或者某些连接失败了?
完整的路由定义:
final RouteDefinition kafkaRouteDefinition = from( "kafka:{{kafka.broker.endpoints}}" +
"?topic={{kafka.topic.name}}" +
"&groupId=my_group" +
"&autoOffsetReset=earliest" +
"&consumersCount={{kafka.consumer.count}}" );
LOG.info( "Kafka route definition: " + kafkaRouteDefinition.toString() );
kafkaRouteDefinition
.routeId( Constants.ROUTE_ID_PROCESS_KAFKA_MESSAGES )
.to( "log:org.apache.camel?level=DEBUG" )
.process( new RawMessageProcessor() ).id( RawMessageProcessor.class.getSimpleName() )
.to( "log:org.apache.camel?level=DEBUG" )
.unmarshal( inputMessageFormat ).id( "ConvertRawMessageToLogline" )
.to( "log:org.apache.camel?level=DEBUG" )
.process( new LoglineMessageProcessor() ).id( LoglineMessageProcessor.class.getSimpleName() )
.to( "log:org.apache.camel?level=DEBUG" )
.to( Constants.CAMEL_PROCESS_ENDPOINT )
.to( "log:org.apache.camel?level=DEBUG" )
.multicast().stopOnException()
.to( "log:org.apache.camel?level=DEBUG" )
.to( Constants.CAMEL_STORE_ENDPOINT
, Constants.CAMEL_INDEX_ENDPOINT
)
.to( "log:org.apache.camel?level=DEBUG" )
.end();
【问题讨论】:
标签: java configuration apache-camel startup error-reporting