【发布时间】:2017-06-03 11:25:21
【问题描述】:
有没有办法将异常子句 (onException) 导入 Camel Spring XML DSL 以在 camelContext 中使用它?
它应该像 routContext 一样工作,这在 in the camel documentation 中进行了解释。您有一个文件,其中包含 routeContext,您可以将其导入主文件并在 camelContext 中使用它:
<!-- import the routes from another XML file -->
<import resource="myCoolRoutes.xml"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<!-- refer to a given route to be used -->
<routeContextRef ref="myCoolRoutes"/>
<!-- we can of course still use routes inside camelContext -->
<route id="inside">
<from uri="direct:inside"/>
<to uri="mock:inside"/>
</route>
</camelContext>
所以我想要一个文件,我们称之为 myCoolException.xml,应该可以将它导入到我的主文件中。所以它会是这样的:
<import resource="myCoolException.xml"/>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<exceptionContextRef ref="myCoolException"/>
...
</camelContext>
我的目标是模块化我的 Camel 文件,如果我想在不同的上下文中重用异常子句,请不要重复自己。
【问题讨论】:
标签: java xml spring apache-camel