简体   繁体   English

ule会话变量线程安全吗?

[英]is mule session variable thread safe?

Hi I have a complex flow where my payload is getting modified along with original payload. 嗨,我有一个复杂的流程,其中我的有效负载与原始有效负载一起被修改。 In order to get the original payload I am storing the initial payload in a mule session variable so that I can use that variable(original payload) down the flow. 为了获得原始有效负载,我将初始有效负载存储在mule session变量中,以便可以在流程中使用该变量(原始有效负载)。 This process is working but my concern is my mule session variable thread safe? 此过程正在运行,但我担心我的m子会话变量线程安全吗?
I tried choosing invocation,outbound scope but I found that variable value become null down the flow after some processing and transformation. 我尝试选择调用,出站范围,但发现经过一些处理和转换后,变量值在流程中变为空。

Any input would be greatly appreciated. 任何投入将不胜感激。 Thanks 谢谢

The mule message is processed by one thread at a time, so variables or properties (any scope) in the mule message don't need to be thread-safe. ule子消息一次只能由一个线程处理,因此message子消息中的变量或属性(任何作用域)不需要是线程安全的。 Invocation scope should be enough if you want to use a property in a single flow. 如果要在单个流中使用属性,则调用范围应该足够。

Apparently, the session variables are not thread safe. 显然,会话变量不是线程安全的。 I used a session variable in a flow that has splitter and aggregator for parallel execution of a piece of code (which modifies the same session variable). 我在具有拆分器和聚合器的流中使用了会话变量来并行执行一段代码(修改了相同的会话变量)。 Found that it overwrites the data inside the splitter thread! 发现它会覆盖拆分线程中的数据!

Session variable is meant for storing values which need to be reference after the flow passes through a transport barrier which could be any connector. 会话变量用于存储在流经过可能是任何连接器的传输屏障之后需要参考的值。 Within the same flow session variable is thread safe. 在同一流会话变量中,线程安全。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM