Mule流变量与会话变量性能

Mule流变量与会话变量性能,mule,mule-studio,mule-el,Mule,Mule Studio,Mule El,除了在Mulesoft页面中描述的流变量和会话变量之间的功能差异外,在使用这两个变量时,是否有任何显著的性能差异需要注意 对于我的项目,使用流和会话变量工作得非常好。因此,我需要决定使用哪个 当消息跨越传输边界时,会话变量会不断序列化和反序列化 但是,您是说您可以在项目中互换使用流或会话变量,因此这意味着您没有任何传输边界(否则您将丢失流变量) 在这种情况下,流和会话变量执行相同的操作:它们只是事件的属性 请注意,会话变量往往会通过HTTP端点泄漏,因此请小心使用它们。 <?xml ver

除了在Mulesoft页面中描述的流变量和会话变量之间的功能差异外,在使用这两个变量时,是否有任何显著的性能差异需要注意


对于我的项目,使用流和会话变量工作得非常好。因此,我需要决定使用哪个

当消息跨越传输边界时,会话变量会不断序列化和反序列化

但是,您是说您可以在项目中互换使用流或会话变量,因此这意味着您没有任何传输边界(否则您将丢失流变量)

在这种情况下,流和会话变量执行相同的操作:它们只是事件的属性

请注意,会话变量往往会通过HTTP端点泄漏,因此请小心使用它们。


<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:http="http://www.mulesoft.org/schema/mule/http" 
    xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" 
    xmlns="http://www.mulesoft.org/schema/mule/core" 
    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans-current.xsd
    http://www.mulesoft.org/schema/mule/core 
    http://www.mulesoft.org/schema/mule/core/current/mule.xsd
    http://www.mulesoft.org/schema/mule/http 
    http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
    http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    <http:request-config name="HTTP_Request_Configuration" host="localhost" port="8034" doc:name="HTTP Request Configuration"/>
    <flow name="understandingvariablesFlow">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/vars" doc:name="HTTP"/>
        <set-variable variableName="flv" value="flowVariable exists" doc:name="LocalVariable"/>
        <set-session-variable variableName="sessVar" value="sessionVariable exists" doc:name="Session Variable"/>
        <flow-ref name="practiceSub_Flow" doc:name="practiceSub_Flow"/>
        <flow-ref name="localVarible" doc:name="localVarible"/>
        <flow-ref name="practiceAnotherFLow" doc:name="practiceAnotherFLow"/>
        <http:request config-ref="HTTP_Request_Configuration" path="/localvar" method="POST" doc:name="HTTP"/>
    </flow>
    <flow name="localVarible">
        <http:listener config-ref="HTTP_Listener_Configuration" path="/localvar" doc:name="HTTP"/>
        <logger message="#[flowVars.flv]" level="INFO" doc:name="LocalVarible Value"/>
        <logger message="#[sessionVars.sessVar]" level="INFO" doc:name="Session Var"/>
    </flow>
</mule>
-------------------------------------------------------------------

<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:secure-property-placeholder="http://www.mulesoft.org/schema/mule/secure-property-placeholder" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
    xmlns:spring="http://www.springframework.org/schema/beans" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
    http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
    http://www.mulesoft.org/schema/mule/secure-property-placeholder http://www.mulesoft.org/schema/mule/secure-property-placeholder/current/mule-secure-property-placeholder.xsd
    http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
    http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd
    http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">
    <http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8034" doc:name="HTTP Listener Configuration"/>
    <sub-flow name="practiceSub_Flow">
        <logger message="Another flow's sub flowPractice #[flowVars.flv] and #[sessionVars.sessVar]" level="INFO" doc:name="Sub flow"/>
    </sub-flow>
    <flow name="practiceAnotherFLow">
        <logger message="Another xml file flow's flowPractice #[flowVars.flv] and #[sessionVars.sessVar]" level="INFO" doc:name="Main Flow"/>
    </flow>
</mule>
-------------------------------------------------------------------
Hi David,我仍然不清楚流变量和会话变量之间的区别。我添加了两个流作为示例,其中我初始化了两个变量,并且它们的行为方式相同,但是它们的存在跨越了传输屏障,您能澄清一下吗