MULE学习笔记.docx
- 文档编号:13040893
- 上传时间:2023-06-10
- 格式:DOCX
- 页数:17
- 大小:348.29KB
MULE学习笔记.docx
《MULE学习笔记.docx》由会员分享,可在线阅读,更多相关《MULE学习笔记.docx(17页珍藏版)》请在冰点文库上搜索。
MULE学习笔记
Mule学习笔记
作者:
郑先全
1.原理
请参考《UsingJBIforService-OrientedIntegration(SOI)》
2.Mule介绍
2.1.架构
2.2.核心概念
请参考《ArchitectureGuid》
2.3.repository
如果想保持新鲜,访问他们的CVS是最好的办法。
cvs-d:
/scm/mulelogin
(nopassword)
cvs-d:
/scm/mulecomule
注意:
从2006年4月14日开始,不再使用cvs,而采用svn,路径如下:
有自己的IDE:
Download:
Eclipseupdatesite:
3.使用
3.1.Mule的安装
我的JDK为1.4.2_05。
下载后,解压缩,并设置MULE_HOME为解压缩目录
测试:
提供的echo例子程序是个比较好的测试工具,放在%MULE_HOME%\samples\echo下,cmd并切换到改目录的bin下,执行,即可看到如下窗口:
恭喜,说明安装成功。
Tip:
事实上,在我的环境中会提示一个关于缺少一个sax文件的错误,郁闷,通过到sax王张并下载后,把里面的解压缩到%MULE_HOME%\lib下,可以解决该问题。
3.2.echo例子分析
参考这个地址()的介绍,应该会有一个比较好的开始。
3.2.1.过程图示
3.2.2.
描述为:
1、通过两种方式接入(红色标识):
一为,另一为Soap(http)方式;
2、每种接入都可以通过接入器(Connector)经过NMR路由转发后,进行输出,目前通过两种方式输出:
一为,另一为Soap(http)方式
可以通过Mule提供的工具生成配置图,如下:
3.2.3.相关代码(TheEchoService)
TheechoServiceisaPOJOthatimplementsanEchoServiceinterface-
publicinterfaceEchoService{
publicStringecho(Stringecho);
}
TheimplementationthePOJOtobemanagedbyMule)lookslike-
packageclassEchoComponentextendsLogComponentimplementsEchoService{
publicStringecho(Stringecho){
returnecho;
}
}
3.2.4.配置和说明
DOCTYPEmule-configurationPUBLIC"-
1、
PleaserefertotheConfigurationGuideforafulldescriptionofalltheparameters.
-->
Tips:
1、endpoint的address并没有实际的意义,但由于在整个Mule实例里面必须唯一,故可以理解为命名空间
2、Transformer必须继承AbstractTransformer,主要实现doTransform接口方法
3.2.5.loanbroker
3.2.5.1.介绍
异步实现:
同步实现:
3.2.5.2.配置图
3.2.5.3.请参考:
类图
3.2.5.4.配置文件详细分析
—定义EndPoint
"/> "/> --Themethodparameterforthebankendpointsisaddedprogrammitcallywhenthebankobjectsare created--> "/> "/> "/> "/> "/> --LoanBrokerDescriptor implementation="">//说明这个类来发出请求而已,并不需要实现特殊接口 //信用代理,注意使用了filter,是为了确保CreditAgency的EndPoint对应的CreditAgencyService具有合适的参数 //贷款方代理,通过filter,使得只有类型为BankQuoteRequest的请求去访问 inboundEndpoint="CreditAgencyReceiver" implementation=""> inboundEndpoint="LenderService" implementation=""> =null"className=""/> //这个过滤器的用处在于说明只有recipients! =null的情况下,才执行必要的逻辑 —下面为几个银行的inbound配置,主要描述几个不同银行的输入 inboundEndpoint="Bank1" implementation=""> inboundEndpoint="Bank2" implementation=""> inboundEndpoint="Bank3" implementation=""> inboundEndpoint="Bank4" implementation=""> inboundEndpoint="Bank5" implementation=""> 3.2.5.5.通过ActiveMQ进行 上述例子是通过构造webservice进行的,很容易通过ActiveMQ来做,主要的调整只要重新定义Enpoint即可。 具体配置文件修改一下即可,如下: DOCTYPEmule-configurationPUBLIC"-//SymphonySoft//DTDmule-configurationXML/EN" ""> --TestingwithActiveMq--> -- --> value="classpath: /"/> --testingwithOpenJms--> -- -- -- -- -- ----> ----> implementation=""> inboundEndpoint="CreditAgencyReceiver" implementation=""> inboundEndpoint="LenderService" implementation=""> =null"className=""/> inboundEndpoint="Bank1" implementation=""> inboundEndpoint="Bank2" implementation=""> inboundEndpoint="Bank3" implementation=""> inboundEndpoint="Bank4" implementation=""> inboundEndpoint="Bank5" implementation=""> 3.2.5.6.小结 这个例子也是EIP书中经典案例的一种实现。 支持同步、异步消息。
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- MULE 学习 笔记