如何在Mule中将javax.mail.internet.MimeMessage转换为java.io.InputStream

时间:2013-07-23 14:19:17

标签: email mule transformer

我试图通过Mule阅读文件和电子邮件。但它引发了以下异常。

  org.mule.api.transformer.TransformerException: Could not find a transformer to    transform "SimpleDataType{type=javax.mail.internet.MimeMessage, mimeType='*/*'}" to "SimpleDataType{type=java.io.InputStream, mimeType='*/*'}".
  at  org.mule.registry.MuleRegistryHelper.lookupTransformer(MuleRegistryHelper.java:252)
  at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:355)
  at org.mule.DefaultMuleMessage.getPayload(DefaultMuleMessage.java:313)
 + 3 more (set debug level logging or '-Dmule.verbose.exceptions=true' for everything)

我的mule文件如下:     

<flow name="Exception_HandlingFlow1" doc:name="Exception_HandlingFlow1">
    <file:inbound-endpoint path="D:\WorkArea\COPA\In" responseTimeout="10000" doc:name="File Writer">
        <file:file-to-string-transformer/>
    </file:inbound-endpoint>
    <component doc:name="Java" class="com.exhnlr.Handler.ExceptionHandler"/>
    <smtps:outbound-endpoint host="192.168.131.139" responseTimeout="10000" doc:name="SMTP" 
        from="anbu1@bibs.com" subject="test" to="anbu1@bibs.com" user="anbu1" mimeType="text/plain">
        <email:string-to-email-transformer/>
    </smtps:outbound-endpoint>        
</flow>

我已经阅读了类似的链接How to parse inbound e-mail when using Mule's IMAP transport?,但它对我不起作用。

请帮忙。

1 个答案:

答案 0 :(得分:0)

在文件入站端点后添加<object-to-string-transformer />