我们有以下场景:
-
客户发送包含两部分的XML消息
-
XML的第一部分包含应使用fop组件和XSLT创建PDF的信息
-
XML的第二部分包含邮件正文,主题等中使用的信息 .
In the camel configuration:
-
传入的XML可以转换为XSL:FO(使用XSLT)
-
可以调用fop组件,而不是PDF文档
-
可以调用邮件组件,但我遇到以下问题
-
包含邮件信息的原始邮件不再可用 . 一种可能性是将原始主体存储在 Headers 或属性中
-
PDF应作为附件添加 . 我认为没有默认的处理器,过滤器等可用于将主体移动到附件 . 所以我必须编写自己的处理器
Questions
-
有没有人为类似的用例提供示例骆驼配置?
-
可能是一个Splitter模式,但当前示例在XML文件中有多个订单,而我们的XML文件不包含多个项目但包含一些数据 . 是否有另一种模式可以在这个用例中使用?
任何建议都会非常有用 .
我尝试使用下面的camel配置,但在合并策略中,zip从不存在 . 看起来createZip路由没有响应
<camel:multicast strategyRef="mergeStrategy">
<camel:to uri="direct:createZip"/>
<camel:to uri="direct:createRequestMessage"/>
</camel:multicast>
<camel:to uri="smtp://server?to=michel@mail-pd.beinformed.com"></camel:to>
</camel:route>
<camel:route>
<camel:from uri="direct:createZip" />
<camel:from uri="file:////data/tmp/zip/input">
<camel:description>Reading files from the input folder</camel:description>
</camel:from>
<camel:aggregate strategyRef="zipStrategy" eagerCheckCompletion="true" completionFromBatchConsumer="true">
<camel:correlationExpression>
<camel:constant>true</camel:constant>
</camel:correlationExpression>
<camel:setHeader headerName="dummybody">
<camel:simple>${body}</camel:simple>
</camel:setHeader>
</camel:aggregate>
<camel:setHeader headerName="Strategy-Attachment">
<camel:constant>true</camel:constant>
</camel:setHeader>
</camel:route>
<camel:route>
<camel:from uri="direct:createRequestMessage" />
<camel:to uri="create_request.xslt?saxon=true" />
<camel:setHeader headerName="Content-Type">
<camel:constant>text/html</camel:constant>
</camel:setHeader>
<camel:setHeader headerName="Strategy-Body">
<camel:constant>true</camel:constant>
</camel:setHeader>
</camel:route>
1 回答
您使用
direct:createZip
的路线是错误的,您可能无法在同一路线中获得2 x . 相反,您应该使用Content Enricher EIP模式:http://camel.apache.org/content-enricher.html您可以使用
<pollEnrich>
来使用该文件 . 想一想如果没有文件该怎么办,那么你需要设置一个超时 . 请阅读有关此文档的文档 .