第一次在javaeye上写博客 过去都是在csdn上写的 写的那里不好请大家多多指教 呵呵
今年做了一个项目 其中一个环节是定时收取邮件然后进行持久化 发现如果使用mule相当简单 不多说了 给大家看看代码吧
pop_config.xml
<mule xmlns="http://www.mulesource.org/schema/mule/core/2.1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:file="http://www.mulesource.org/schema/mule/file/2.1"
xmlns:pop3="http://www.mulesource.org/schema/mule/pop3/2.1"
xmlns:email="http://www.mulesource.org/schema/mule/email/2.1"
xmlns:xm="http://www.mulesource.org/schema/mule/xml/2.1"
xmlns:stdio="http://www.mulesource.org/schema/mule/stdio/2.1"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.mulesource.org/schema/mule/core/2.1 http://www.mulesource.org/schema/mule/core/2.1/mule.xsd
http://www.mulesource.org/schema/mule/file/2.1 http://www.mulesource.org/schema/mule/file/2.1/mule-file.xsd
http://www.mulesource.org/schema/mule/pop3/2.1 http://www.mulesource.org/schema/mule/pop3/2.1/mule-pop3.xsd
http://www.mulesource.org/schema/mule/email/2.1 http://www.mulesource.org/schema/mule/email/2.1/mule-email.xsd
http://www.mulesource.org/schema/mule/xml/2.1 http://www.mulesource.org/schema/mule/xml/2.1/mule-xml.xsd
http://www.mulesource.org/schema/mule/stdio/2.1 http://www.mulesource.org/schema/mule/stdio/2.1/mule-stdio.xsd"
>
<global-property name="pop3.host" value="pop3.126.com"/>
<global-property name="pop3.port" value="110"/>
<global-property name="pop3.user" value="******"/>
<global-property name="pop3.password" value="*******"/>
<model name="pop3Model">
<service name="pop3Service">
<inbound>
<pop3:inbound-endpoint host="${pop3.host}" port="${pop3.port}" user="${pop3.user}" password="${pop3.password}">
</pop3:inbound-endpoint>
</inbound>
<component class="com.muleinaction.Test"/>
<outbound>
<pass-through-router>
<file:outbound-endpoint path="./out" outputPattern="pop-[DATE].txt"/>
</pass-through-router>
</outbound>
</service>
</model>
</mule>
意思是将我邮箱里的信读入 然后通过component进行业务处理 最后用file进行输出 简单的很
下面看看com.muleinaction.Test吧 也是超级简单:
package com.muleinaction;
import org.mule.util.Base64;
public class Test {
public String test(javax.mail.internet.MimeBodyPart m){
try {
return m.getFileName()+" "+m.getContent()+" "+m.getEncoding();
} catch (Exception e) {
return "error";
}
}
}
这样运行后就可以进行邮件收取了
分享到:
相关推荐
mule配置常用节点解释,示例模型,基本标签
mule的配置文档 自己整理,很实用滴,希望大家可以和我一样少走歪路
关于在tomcat上进行mule多线程数量参数配置
Mule ESB 是一个轻量级的基于java的企业服务总线和集成平台, 使得开发人员可以快速,简单的连接多个应用, 使得它们可以交换数据。 Mule ESB 容易集成现有异构系统,包括:JMS, Web Services, JDBC, HTTP, 等. ESB...
利用mule 服务总线代理 cxf发布的服务。其中详细的描述了cxf服务的发布的访问,以及如何使用mule的代理模式代理cxf的服务。步骤详细,有图有真相.
你不需要深入了解 Mule 的 XML 配置语法,就 可以在几分钟内轻松的创建、编辑、测试 Mule ESB 流程。 • 对于非 Mule 开发人员或者 Mule 新手开发人员, Mule Studio 其中一个最大的好处是用图形化的方式创建 Mule ESB...
Mule是一个企业服务总线(ESB)消息框架,而且Mule是一个轻量级且高度可扩展的ESB。
Mule ESB应用部署 Mule ESB应用的目录结构,配置文件说明
Mule in Action, Second Edition is a totally-revised guide covering Mule 3 fundamentals and best practices. It starts with a quick ESB overview and then dives into rich examples covering core concepts ...
mule in action 和doc文档详细介绍 Mule的核心组件是UMO(Universal Message Objects,从Mule2.0开始UMO这一概念已经被组件Componse所代替),UMO实现整合逻辑。UMO可以是POJO,JavaBean等等。它支持30多种传输协议...
Mule is the most widely used open source ESB-with millions of downloads-providing an alternative to expensive commercial options. Mule in Action is acomprehensive tutorial designed for working Java ...
mule开发帮助文档,关于配置开发等等
Mule ESB 项目在Linux中的部署与开发与应用案例
文档主要介绍了Mule ESB的使用方法,并结合具体实例加深对ESB的理解,对新手很有帮助哦!
Mule是一个以Java为核心的轻量级的消息框架和整合平台,基于EIP(Enterprise Integeration Patterns,由Hohpe和Woolf编写的一本书)而实现的。Mule的核心组件是UMO(Universal Message Objects,从Mule2.0开始UMO这一...
mule -esb 源码