Studio+Update+Sites4Message ProcessorsComponents.docx
《Studio+Update+Sites4Message ProcessorsComponents.docx》由会员分享,可在线阅读,更多相关《Studio+Update+Sites4Message ProcessorsComponents.docx(90页珍藏版)》请在冰豆网上搜索。
Studio+Update+Sites4MessageProcessorsComponents
MessageProcessors
AfterMulereceivesamessagefromaMessageSource,itusesoneormoremessageprocessorstoprocessthemessagethroughaflow.
MessageProcessorscanbecategorizedbyfunctionasfollows:
∙ComponentsareflexibletoolswhichperformbusinesslogicimplementedinJavaandotherscriptinglanguages.
∙Filtersonlyallowcertainmessagestocontinuetobeprocessedinaflow.
∙Routerscontrolmessageflowtoroute,resequence,orsplitandaggregatemessagesinaflow.
∙Scopeswrapothermessagesprocessorssoastoenablethemtoperformtogetherasagroup.
∙Transformersconvertmessagepayloadtypeanddataformattofacilitatecommunicationbetweensystems.
Browsethesectionsbelowforfurtherdetails.
∙Components
∙Filters
∙Routers
∙Scopes
∙Transformers
∙BusinessEvents
Components
ThebuildingblocksknownasComponentsfallintothreecategories:
General,Script,andWebService.
Generalcomponentsexecutewheneveramessageisreceived.ThelogicembeddedintoGeneralcomponentscannotbemodified.ComponentssuchasLogging,FlowReference,andEchofallintothiscategory.
Scriptcomponentsdonotcontainpre-packagedlogic;insteadtheyallowthedevelopertospecifythelogic(intheformofacustomscriptoraJavaclass)toaddintothecomponent.Scriptcomponentsalsoallowyouto:
∙configureinterceptors
∙addSpringbeans
∙changethevalueorreferenceofaspecificpropertywithintheassociatedclass
TheJavaComponentallowsyoutoreferenceaJavaclass.TheotherScriptcomponentssupporttheGroovy,JavaScript,PythonandRubyscriptingengines.
WebServicecomponents,asthenameimplies,enableMuletouseSOAPandRESTfulprotocolstocommunicatewithexternalWebservices.TheSOAPandRESTfulcomponentsuseCXFandJerseyservicestoconvertmessagesfromJavatoXML.WebServicecomponentsalsoallowthedevelopertoselectordefinethelogictobeinvokedbycomponent.IfusingtheRESTfulcomponentyouonlyneedtoselectaJavaclassandaddascripttothecomponent.Ontheotherhand,SOAPconfigurationrequiresyoutodefineattributesandselecttheoperationmethodusedtopublishaSOAPWebservice.AsanexampleofhowtheCXFcomponentcanbeused,aSOAPmessagecouldbesenttoaWeb-service-enabledwebsitesuchasausedcarpricedatabase,withtheparametersneededforasearch.ThesitewouldthenreturnanXML-formatteddocumentwiththeresultingdata,e.g.,prices,modelandfeatures.Thedatareturnedisthenintegrateddirectlyintoathird-partywebsiteorapplication.
ConfiguringComponents
Toconfigureacomponent,double-clickonthecomponenttoopenthePropertiesEditorintheconsole.EverycomponentintheStudiopaletteincludestwocommonfields:
DisplaynameandNotes,bothofwhichareoptionalandshouldbefamiliartoStudiousers,becausetheyarecommontovirtuallyallStudiobuildingblocks.
Beyondthetwocommonfields,mostComponentsdonotrequireextensiveconfiguration.ThefivescriptcomponentsavailablewithinStudiosupportalmostidenticalpropertypanefields.
Fordetails,seetheindividualcomponentreferencepagesonhowtouseandconfigureeachtypeofcomponent.
ComponentsAvailableinAnypointStudio
ThefollowingthreetableseachdetailoneoftheStudioComponentsub-groups:
GeneralComponents
Generalcomponentsallowyoutoenhanceaflowbyattachingfunctionalitysuchasloggingordisplayingoutput.
Components
Description
Documentation
Echo
Outputsthemessagebeingprocessedtoalogordisplay,thenpassesthemessagetothenextbuildingblockintheflow.
EchoComponentReference
FlowReference
Thisbuildingblockcallsanotherexternalflow.Thecalledflowcanbeoneoftwotypes:
Asubflow,whichinheritstheprocessingstrategyandexceptionhandlingpropertiesofthecallingflow.
Achildflow,whichsetsitsownprocessingstrategyandexceptionhandlingproperties.
IfthecalledflowisSynchronous,thecallingflowwaitsuntilthecalledflowcompletesexecution,thenresumes.IfthecalledflowisAsynchronous,thecallingflowresumesexecutionimmediately.
FlowReferenceComponentReference
Logger
Logscustomstrings,includingstringsconstructedfromembeddedexpressions.Alsoallowsspecificationoflogginglevelandcategory.
LoggerComponentReference
ScriptComponents
ScriptcomponentsfacilitateSoftwareasaService(SaaS)integrationbyprovidinglanguage-specific"shells"tomakecustom-codedbusinesslogicavailableinaMuleapplication.YoucanwritethebusinesslogicinJava,Ruby,JavaScript,Groovy,orPython.
Components
Description
Documentation
Groovy
FacilitatestheintegrationofacustomscriptbackedbytheGroovyscriptengine.
GroovyComponentReference
Java
AllowsyoutoselectaJavaclasstobe