Mule:如何从 IMAP 连接器捕获附件?
Mule: How to capture attachment from IMAP connector?
我的测试流程成功查询了一个 imap 收件箱。我正在尝试捕获附件并将它们保存到输出文件夹。到目前为止,我还没有取得任何成功。我尝试过 "Attachment" 转换以及从 IMAP 传输文档中复制和粘贴示例。我不确定该示例是否已过时或什么,但我一直收到错误消息。
这是来自 IMAP 文档中 "Configuration Example" 的代码:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:imap="http://www.mulesoft.org/schema/mule/imap"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd
http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/imap/3.6/mule-imap.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/3.6/mule-email.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd">
<imap:connector name="imapConnector" />
<expression-transformer name="returnAttachments">
<return-argument evaluator="attachments-list" expression="*" optional="false"/> ❶
</expression-transformer>
<file:connector name="fileName">
<file:expression-filename-parser/>
</file:connector>
<flow name="incoming-orders">
<imap:inbound-endpoint user="bob" password="password" host="emailHost"
port="143" transformer-refs="returnAttachments" disableTransportTransformer="true"/> ❷
<collection-splitter/>
<file:outbound-endpoint path="./received" outputPattern="#[function:datestamp].dat"> ❹
<expression-transformer>
<return-argument expression="payload.inputStream" evaluator="groovy" /> ❺
</expression-transformer>
</file:outbound-endpoint>
</flow>
</mule>
这是我得到的错误(更改所有连接详细信息后):
Element 'expression-transformer' cannot have character [children], because the type's content type is element-only.
相关信息:
- Mule ESB 和集成平台
- 版本:3.6.0 构建:ed775fdb
- JDK: 1.8.0_31(混合模式)
- OS: Windows 8.1 - (6.3, amd64)
- 主机:计算机名 (192.168.1.116)
我只能使用您提供的确切配置才能得到该错误,因为其中有奇怪的字符,请参阅:❶
我猜你是从文档站点复制粘贴的?这些是文档中的参考。
删除它们,它应该可以工作。
我的测试流程成功查询了一个 imap 收件箱。我正在尝试捕获附件并将它们保存到输出文件夹。到目前为止,我还没有取得任何成功。我尝试过 "Attachment" 转换以及从 IMAP 传输文档中复制和粘贴示例。我不确定该示例是否已过时或什么,但我一直收到错误消息。
这是来自 IMAP 文档中 "Configuration Example" 的代码:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:imap="http://www.mulesoft.org/schema/mule/imap"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:file="http://www.mulesoft.org/schema/mule/file"
xmlns:email="http://www.mulesoft.org/schema/mule/email"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.6/mule.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/3.6/mule-file.xsd
http://www.mulesoft.org/schema/mule/imap http://www.mulesoft.org/schema/mule/imap/3.6/mule-imap.xsd
http://www.mulesoft.org/schema/mule/email http://www.mulesoft.org/schema/mule/email/3.6/mule-email.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/3.6/mule-vm.xsd">
<imap:connector name="imapConnector" />
<expression-transformer name="returnAttachments">
<return-argument evaluator="attachments-list" expression="*" optional="false"/> ❶
</expression-transformer>
<file:connector name="fileName">
<file:expression-filename-parser/>
</file:connector>
<flow name="incoming-orders">
<imap:inbound-endpoint user="bob" password="password" host="emailHost"
port="143" transformer-refs="returnAttachments" disableTransportTransformer="true"/> ❷
<collection-splitter/>
<file:outbound-endpoint path="./received" outputPattern="#[function:datestamp].dat"> ❹
<expression-transformer>
<return-argument expression="payload.inputStream" evaluator="groovy" /> ❺
</expression-transformer>
</file:outbound-endpoint>
</flow>
</mule>
这是我得到的错误(更改所有连接详细信息后):
Element 'expression-transformer' cannot have character [children], because the type's content type is element-only.
相关信息:
- Mule ESB 和集成平台
- 版本:3.6.0 构建:ed775fdb
- JDK: 1.8.0_31(混合模式)
- OS: Windows 8.1 - (6.3, amd64)
- 主机:计算机名 (192.168.1.116)
我只能使用您提供的确切配置才能得到该错误,因为其中有奇怪的字符,请参阅:❶ 我猜你是从文档站点复制粘贴的?这些是文档中的参考。 删除它们,它应该可以工作。