377.7. 使用 XQuery 作为端点
有时,XQuery 表达式可能非常大,它可用于 Templating。因此,您可能希望使用 XQuery 端点,以便您可以使用 XQuery 模板进行路由。
以下示例演示了如何获取 ActiveMQ 队列(MyQueue)的消息并使用 XQuery 将其转换为 MQ 系列。
<camelContext id="camel" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="activemq:MyQueue"/>
<to uri="xquery:com/acme/someTransform.xquery"/>
<to uri="mqseries:SomeOtherQueue"/>
</route>
</camelContext>
XQuery 中的自定义功能可能会导致 NullPointerException (Camel 2.18, 2.19 和 2.20)。这应该在 Camel 2.21 中修复