您好,欢迎访问三七文档
当前位置:首页 > 临时分类 > MULE学习重点笔记专业资料
Mule学习笔记作者:郑先全msn:1.原理请参照《UsingJBIforService-OrientedIntegration(SOI)》2.Mule简介2.1.架构2.2.核心概念请参照《ArchitectureGuid》2.3.repository如果想保持新鲜,访问她们CVS是最佳办法。cvs-d:pserver::/scm/mulelogin(nopassword)cvs-d:pserver::/scm/mulecomule注意:从4月14日开始,不再使用cvs,而采用svn,途径如下:2.4.IDE有自己IDE:Download:Eclipseupdatesite:3.Mule使用3.1.Mule安装我JDK为1.4.2_05。下载后,解压缩,并设立MULE_HOME为解压缩目录测试:提供echo例子程序是个比较好测试工具,放在%MULE_HOME%\samples\echo下,cmd并切换到改目录bin下,执行mule-echo.bat,即可看到如下窗口:恭喜,阐明安装成功。3.2.echo例子分析参照这个地址(+Example)简介,应当会有一种比较好开始。3.2.1.过程图示描述为:1、通过两种方式接入(红色标记):一为System.in,另一为Soap(http)方式;2、每种接入都可以通过接入器(Connector)通过NMR路由转发后,进行输出,当前通过两种方式输出:一为System.out,另一为Soap(http)方式可以通过Mule提供工具生成配备图,如下:Tip:事实上,在我环境中会提示一种关于缺少一种sax文献错误,郁闷,通过到sax王张并下载sax2r3.zip后,把里面xml-apis.jar解压缩到%MULE_HOME%\lib下,可以解决该问题。3.2.2.有关代码(TheEchoService)TheechoServiceisaPOJOthatimplementsanEchoServiceinterface-publicinterfaceEchoService{publicStringecho(Stringecho);}Theimplementation(i.ethePOJOtobemanagedbyMule)lookslike-packageorg.mule.components.simple;publicclassEchoComponentextendsLogComponentimplementsEchoService{publicStringecho(Stringecho){?xmlversion=1.0encoding=UTF-8?!DOCTYPEmule-configurationPUBLIC-//SymphonySoft//DTDmule-configurationXMLV1.0//EN!--整体配备--mule-configurationid=Mule_Echo_Sampleversion=1.0!--配备描述--description描述/description!--连接器配备--connectorname=SystemStreamConnectorclassName=org.mule.providers.stream.SystemStreamConnectorpropertiespropertyname=promptMessagevalue=Pleaseentersomething:/propertyname=messageDelayTimevalue=1000//properties/connector!--模型配备--modelname=echoSamplemule-descriptorname=EchoUMOimplementation=org.mule.components.simple.EchoComponent!—接入点设立,当前为stream和axis两种类型--returnecho;}}3.2.3.配备和阐明Tips:1、可以通过干预web.xml,逐个加载需要揣摩例子,便于分析;2、开始时,使用默认加载方式。3.3.Webapp例子分析这个例子其实是对原有几种例子在webapp集成,通过使用MuleClient进行基于编码调用。3.3.1.略echo例子3.3.2.Hello例子inbound-routerendpointaddress=stream://System.in/endpointaddress=axis:!—输出点设立,当前为stream类型--outbound-routerrouterclassName=org.mule.routing.outbound.OutboundPassThroughRouterendpointaddress=stream://System.out//router/outbound-router/mule-descriptor/model/mule-configurationPOJO/javabean:NameString.javaChatString.javaSERVICE:Greeter.javaChitChatter.javaTransformer:HttpRequestToString.java3.3.2.1.简介本例子重要用于演示两个transformer、两个UMO之间信息转换和事件交互。3.3.2.2.代码分析几种java文献,阐明如下:GreeterUMOTransformer:StringToNameStringTransformer:NameStringToChatStChitChatUMOparam-value/WEB-INF/mule-config.xml,/WEB-INF/mule-echo-config.xml,/WEB-INF/mule-hello-config.xml/param-value!--转换器transformerstransformername=StringToNameStringclassName=org.mule.samples.hello.StringToNameStringreturnClass=org.mule.samples.hello.NameString/transformername=NameStringToChatStringclassName=org.mule.samples.hello.NameStringToChatStringreturnClass=org.mule.samples.hello.ChatString//transformers!--AMuledescriptordefinesallthenecessaryinformationabouthowyourcomponentswillinteractwiththeframework,othercomponentsinthesystemandexternalsources.PleaserefertotheConfigurationGuideforafulldescriptionofalltheparameters.--mule-descriptorname=GreeterUMOimplementation=org.mule.samples.hello.Greeterinbound-router3.3.2.3.配备Web.xmlMule-hello-config.xmlNameStringToChatString.javaStringToNameString.javaChatStringToString.javaTips:1、endpointaddress并没有实际意义,但由于在整个Mule实例里面必要唯一,故可以理解为命名空间2、Transformer必要继承AbstractTransformer,重要实现doTransform接口办法3.3.3.loanbroker3.3.3.1.简介异步实现:endpointaddress=vm://greetertransformers=StringToNameString/endpointaddress=servlet://greetertransformers=StringToNameString//inbound-routeroutbound-routerrouterclassName=org.mule.routing.outbound.OutboundPassThroughRouterendpointaddress=vm://chitchatter//router/outbound-router/mule-descriptormule-descriptorname=ChitChatUMOimplementation=org.mule.samples.hello.ChitChatterinbound-routerendpointaddress=vm://chitchattertransformers=NameStringToChatString//inbound-router/mule-descriptor同步实现:3.3.3.2.配备图请参照:+Broker+Example3.3.3.3.类图mule-configurationid=Loan_broker_Syncversion=1.0!—定义EndPointendpoint-identifiersendpoint-identifiername=LoanBrokerRequestsvalue=vm://LoanBrokerRequests/endpoint-identifiername=LoanBrokerQuotesvalue=vm://LoanQuotes/endpoint-identifiername=CreditAgencyvalue=axis:=getCreditProfile/endpoint-identifiername=CreditAgencyReceivervalue=axis:=LenderServicevalue=vm://localhost/LenderService?method=setLenderList/3.3.3.4.配备文献详细分析!--Themethodparameterforthebankendpointsisaddedprogrammitcallywhenthebankobjectsarecreated--endpoint-identifiername=Bank1value=axis:=Bank2value=axis:=Bank3value=axis:=Bank4value=axis:
本文标题:MULE学习重点笔记专业资料
链接地址:https://www.777doc.com/doc-8765424 .html