flowvar and sessionvar in mule
TRANSCRIPT
![Page 1: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/1.jpg)
FlowVars vs SessionVars
![Page 2: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/2.jpg)
FlowVars
• flowVars retain their values as control passes from one message processor to another within a single flow. Thus, you can set them in one message processor, then access them in another message processor using a MEL expression
![Page 3: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/3.jpg)
SessionVars
• sessionVars that retain their values as control passes from one flow to another within an application. Thus, you can set them in one flow, then access them in another using a MEL expression.
![Page 4: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/4.jpg)
Using FlowVars and SessionVars in Mule
Application
![Page 5: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/5.jpg)
![Page 6: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/6.jpg)
• Based from the previous slide, I assume you already have a based project to start working on this.
• Simply used http for the inbound so we could test the functionality and difference of flowVars and sessionVars
![Page 7: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/7.jpg)
![Page 8: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/8.jpg)
• Based from the previous slide, I simply inititiate or declare the values for the flow vars and session vars.
• testFlowVar "this is a flowvar"
• testSessionVar "this is a sessionVar"
![Page 9: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/9.jpg)
Log result
![Page 10: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/10.jpg)
![Page 11: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/11.jpg)
![Page 12: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/12.jpg)
• Based from the result, you can access session var within the mule application while the flow var can only be access within the flow only.
![Page 13: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/13.jpg)
Reference:
• https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-reference#context-objects-variables-and-fields
![Page 14: Flowvar and Sessionvar in Mule](https://reader031.vdocuments.mx/reader031/viewer/2022021815/58eec0841a28ab2d0b8b45af/html5/thumbnails/14.jpg)
END