<route> <fromuri="timer:xml?period=5s"/> <intercept> <touri="log:hello"/> </intercept> <logmessage="I am XML"/> <logmessage="I am YAML"/> </route>
运行日志
每个步骤都会处理拦截
1 2 3 4
13:56:05.423 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO hello - Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]] 13:56:05.424 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO route1 - I am XML 13:56:05.424 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO hello - Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]] 13:56:05.424 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO route1 - I am YAML
interceptFrom
DSL 示例
1 2 3 4 5 6 7 8
<route> <fromuri="timer:xml?period=5s"/> <interceptFrom> <touri="log:hello"/> </interceptFrom> <logmessage="I am XML"/> <logmessage="I am YAML"/> </route>
运行日志
仅拦截传入的步骤
1 2 3
14:11:09.483 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO hello - Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]] 14:11:09.483 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO route1 - I am XML 14:11:09.484 [Camel (MyJavaLoader) thread #1 - timer://xml] INFO route1 - I am YAML