我有一个接收 XML 请求的流。然后,我调用一个 jdbc 出站端点,对 Oracle 数据库执行查询。然后使用 xquery 转换器将查询结果转换为 XML 并发送回。数据库中的 sql 最多返回 50 000 行,但 xquery 转换器创建的 XML 文件每行有 60 行,从而导致 XML 文件非常大(15-100 MB)。Mule 花了很长时间“映射/创建”XML 文件,我想知道我是否可以以某种方式加快这个过程,或者我是否必须重新考虑我的方法。
问候,
马格努斯
Zorba 提供了 JDBC 连接器和流功能:http ://www.zorba-xquery.com/ 这可能正是您正在寻找的。
直接来自 Mule 的文档:
Efficient Transformations with DelayedResult
Mule contains a special XML output format called DelayedResult. This format allows very efficient XML transformations by delaying any XML serialization until an OutputStream is available.
For example, here is an XSLT transformer set up to use DelayedResult:
<mxml:xslt-transformer name="transform-in"
xsl-file="xslt/transform.xslt"
returnClass="org.mule.module.xml.transformer.DelayedResult"/>
If the result of this transformation were being sent to an HTTP client, the HTTP client would ask Mule for an OutputHandler and pass in the OutputStream to it. Only then would Mule perform the transformation, writing the output directly to the OutputStream.
If DelayedResult were not used, the XML result would first be written to an in-memory buffer before being written to the OutputStream. This will cause your XML processing to be slower.
因此,使用 XSLT 转换器而不是 XQuery 转换器更有意义。