Studio+Update+Sites17Debugging文档格式.docx
《Studio+Update+Sites17Debugging文档格式.docx》由会员分享,可在线阅读,更多相关《Studio+Update+Sites17Debugging文档格式.docx(20页珍藏版)》请在冰豆网上搜索。
atanybuildingblockinyourflowthatyouwishtocheckortest(seeimagebelow).WhenyourunyourapplicationinDebugmode,theapplicationstopsimmediatelyafterexecutingthebuildingblockwiththebreakpoint.Usingthe
MuleDebuggerView,youcanbrowsethroughthecontentsofthemessageasitexistsatthatpointintheflow,andevaluate
MuleExpressions
againstthemessage.
NotethattheVisualDebuggeriscompletelydistinctfromtheJavaDebuggercontainedinStudio;
infact,youmayrunbothdebuggersconcurrentlyonyourapplication.
Assumptions
Thisdocumentassumesthatyouarefamiliarwiththe
VisualEditorinMuleStudio,particularly
StudioBuildingBlocks.
Reviewthe
GettingStartedwithMuleStudio
chaptertolearnmoreaboutdevelopingwithMuleESB'
sgraphicaluserinterface.
Prerequisites
Whendebuggingonyourlocalmachine,StudioVisualDebuggerlistensforincomingTCPconnectionsonlocalhostport6666.Thisportmustbeavailableonyourmachine,i.e.notblockedbyafirewallorothersecuritysoftware.
IfyouplantoremotelydebuganapplicationrunninginanexternalMuleESBserver,youwillneedconnectivitybetweenyourmachine(whereyourunStudioVisualDebugger)andtheESBserver'
sdebugport,bydefault6666.EnsurethattherearenoroutingissuesorfirewallsblockingaccessbetweenyourhostandtheESBserver'
sdebugport.
(Foradditionalinformationonremotedebugging,seethesection
DebuggingRemotely
inthispage.)
TestingconnectivitytoaremoteMuleESBserverwiththetelnetcommand
UsingtheVisualDebugger
Completethefollowingmacro-stepstousetheVisualDebuggerinStudio.
1.Set
breakpointsonbuildingblocksinyourapplication.
2.Run
theapplicationinDebugmode.
3.View
and/or
evaluate
thedatainthefirstbuildingblockwithabreakpoint.
4.Resumeapplicationexecution.
5.Repeatstep3withthenextbuildingblockwithabreakpoint,ifany.
SettingBreakpoints
1.Right-clickabuildingblock,thenselect
Togglebreakpoint.
2.Studioappliesareddottothebuildingblock'
sicononthecanvas.
WhenyourunyourapplicationinDebugmode,Studiostopstheflowexecutionatthebreakpointyouhaveset,allowingyoutocheckthemessagecontentsinthe
MuleDebuggerView.
RunninginDebugMode
1.Inthe
PackageExplorer
pane,right-clickyourapplication,thenselect
DebugAs
>
MuleApplication.StudiobeginsrunningtheapplicationinDebugmode,anddisplaysthe
ConfirmPerspectiveSwitch
window.
2.Click
Yes
toopentheDebugperspective,fromwhichyoucanaccessthefullfunctionalityoftheVisualDebugger.
ViewingMessageDataataBreakpoint
WhenyoubeginrunningyourapplicationinDebugmode,Muleopensthe
MuleDebug
perspective.Untilamessagearrivesatthefirstbreakpoint,theMuleDebuggerViewintheconsoledisplaysamessagethatreads,"
ConnectedwithmuleESB.Waitingforamulemessagetoarrive!
"
TheimagebelowillustratestheMuleDebugperspective.
Number
Description
1
MuleDebuggerView
displaysinformationaboutamessagewhentheflowexecutionreachesabreakpoint.Intheimageabove,theapplicationrunninginDebugmodehasnotyetreceivedanymessage,soStudiodisplaysnomessageinformation.
2
MuleBreakpointWatches
tabdisplaystheMuleBreakpointWatchespane,whereyoucanadd,removeandeditMulebreakpointwatches.
3
MuleBreakpointsView
providesalistingofallbreakpointssetinallStudioapplications.
4
DisplaysbreakpointsintheMuleBreakpointsView.
5
Checkboxforsettingabreakpointas
Conditional.Belowitistheinputfieldforenteringthedesiredcondition.Intheimageabove,thecheckboxandtheinputfieldaregrayed-outbecausenobreakpointisselectedintheMuleBreakpointsView.
Whenamessagearrivesatthefirstbreakpoint,the
displaystwopanes,asshownbelow.
Theleftpanedisplaysthemessagepayload(inthiscase,anHTTPGETrequestreceivedviaan
HTTPinboundendpoint).Therightpanedisplaysvariousmetadataassociatedwiththemessage:
∙Inbound:
messageinformation(payloadandmetadata)ifthemessageisinboundorwithinMule
∙Variables:
activeMulevariablesatexecutionbreakpoint
∙Outbound:
messageinformation(payloadandmetadata)ifthemessageisoutbound
∙Session:
activesessionvariablesatexecutionbreakpoint
Toresumeexecution,clickthe
Resume
icon(seebelow)
orpress
F8.Yourapplicationrunsuntilthemessagereachesthenextbreakpoint,ifany.
Ratherthansimplyresumingexecution,youcanchoosetogotothenextmessageprocessor,skiptoaselectedmessageprocessor,orstoptheapplication.See
ExecutionControlTools
forfulldetails.
MuleDebuggerView
ThissectioncontainsafulldescriptionoftheMuleDebuggerViewandallitsavailabletools.
LeftPane
Theleftpanedisplaysthemessagepayloadasatreestructure.
Remarks
Name
columndisplaysthenameofeachmessageproperty.
Thefirstpropertydisplayedisalwaysthenameofthemessageprocessor.
Value
column
Type
Nameofamessageproperty.
Toseeanynestedelementsforaproperty,clickthearrownexttothepropertyname.Youcanseeallobjectsinthemessagepayload.
Valueofeachmessageproperty
Onsomemessageprocessors,youcanchangethemessagepayloadbyeditingthepayloadproperties.VisualDebuggerautomaticallystoresthemodifiedpayloadobject.Whenyouresumerunningtheapplication,themessageprogresseswiththemodifiedvalue.
Toeditamessageproperty:
1.Clickthevalueyouwishtochange.
2.Typeanewvalue.
3.Press
Enter.
RightPane
Therightpanedisplaysmessagemetadata.
6
Inbound
panedisplaysmessagedataifthemessageprocessorisaninboundendpoint.
7
Variables
panedisplaysanyMulevariablecurrentlyactive.
8
Outbound
panedisplaysmessagedataifthemessageprocessorisanoutboundendpoint.
9
Session
panedisplaysanysessionvariablecurrentlyactive.
ExecutionControlTools
UsethetoolsdescribedinthetablebelowtoperformactionsinMuleDebugperspective.
Icon
Shortcut
10
Terminate–
Clicktostopthecurrentlyrunningapplication.
11
EvaluateMuleExpression–
ClicktoevaluateaMuleexpression.
Mac:
Command+SHIFT+i
LinuxandWindows:
Ctrl+SHIFT+i
12
NextProcessor–
Clicktoruntheapplicationandstopatthenextmessageprocessorintheflow,evenifthereisnobreakpointatthenextprocessor.
F6
13
RuntoProcessor–
Clicktoruntheapplicationandstopatthecurrentlyselectedprocessor,evenifthereisnobreakpointatthecurrentlyselectedprocessor.Emulatesthebehaviorofthe"
Runtocursor"
optioninJavadebuggers.(Toselectaprocessor,single-clickitsbuildingblockinthecanvas.)
F7
14
Resume–
Clicktoruntheapplicationuntilthenextbreakpoint,ifany.
F8
EvaluatingMuleExpressions
CompletethefollowingstepstotestaMuleexpressionagainstthemessageprocessorsetwithabreakpoint.
1.EnsurethatStudiohasstoppedflowexecutionatthedesiredbreakpoint.Whenstopped,thebreakpointappearssurroundedbyadottedbluelineinthecanvas,andStudiopopulatesthe
withinformation.
2.Clickthe
EvaluateMuleExpression
icon
abovetheright-handpaneintheMuleDebuggerView.Studiodisplaystheexpressionevaluationwindow(withyellowbackgroundintheimagebelow).
3.TypetheMuleexpressionyouwishtoevaluateintheprovidedinputfield,thenpress
enter.Studioevaluatestheexpression,thendisplaystheresultinthe
Name,
and
columns.
Forinstance,intheexample
above,themessageisanHTTPrequestcontainingtwoproperties,
Symbol
Method.Toseethevaluefor
Method,enter
#[message.inboundProperties['
Method'
],thenpress
Usingtheexpressionevaluationwindow,youcanalsoeditmessagepropertiesorattributes.Simplyright-clickthepropertyvalueorattribute,typethenewvalue,thenpress
enter.
SettingBreakpointParameters
Youcanconfigurebreakpointsaccordingtothreeparameters,describedinthetablebelow.Theseparametersaresetinthe
MuleBreakpointsView.
Type
Default(noparameters)
Defaultconfigurationforauser-definedbreakpoint.Thebreakpointissetonauser-definedbuildingblock,andactivatedbydefault.Whenamessagereachesthebreakpointbuildingblock,StudiostopsflowexecutionanddisplaysthecontentsofthemessageintheMuleDebuggerView.
Conditional
Thebreakpointisactivatedonlyifauser-definedconditionevaluatesto
true.
Exception
Thisisaglobalparameter.Whenset,Studiostopsflowexecution
atanybuildingblock
whereanexceptionoccurs.TheMuleDebuggerViewwilldisplaythemessagecontentsatthebuildingblockthatthrewtheexception.
Settheseparametersinthe
MuleBreakpoints
view,describedbelow.
MuleBreakpointsView
ThisviewdisplaysallbreakpointsdefinedinalltheapplicationscurrentlyopeninStudio.Toaccessthe
view,ensurethatyouarecurrentlyinthe
DebugPerspective.(Ifnot,click
underthemaintoolbar).Fromt