Flowvar and Sessionvar in Mule

Preview:

Citation preview

FlowVars vs SessionVars

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

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.

Using FlowVars and SessionVars in Mule

Application

• 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

• 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"

Log result

• 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.

Reference:

• https://docs.mulesoft.com/mule-user-guide/v/3.6/mule-expression-language-reference#context-objects-variables-and-fields

END

Recommended