在执行flow子流程期间维护有效负载状态 [英] Maintain Payload State during mule flow execution

查看:81
本文介绍了在执行flow子流程期间维护有效负载状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是确保流执行期间保持有效负载状态的最佳方法.我有一个流程可以执行多个数据库和Web服务执行,但是每次执行连接器执行时,我的有效负载都会丢失.保持这一点. 为了保持状态,我所有的连接器执行都在消息增强器范围内执行,并且这些出站连接器的响应都填充在变量中.即使我觉得这些都是对内存的完全浪费.

what is the best way to ensure payload state is maintained during a flow execution. I have a flow that performs multiple database and webservice executions, but everytime i perform a connector execution my payload gets lost. to maintain this. To maintain state, all my connector executions are being performed in a message enricher scope and the responses from these outbound connectors are populated in variables. Even though I feel these are a complete waste of memory.

请告知.

致谢 桑托什

推荐答案

如果没有将其他db/ws调用的结果放入flowVars,您将如何处理?您想把它们放在哪里?

What would you be doing with the results of these other db / ws calls if you didnt put them in flowVars? Where would you like to hold them?

如果您不想丢失原始有效负载,则可能在使用MessageEnricher做正确的事情.

You are probably doing the right thing to use MessageEnricher if you dont want to loose the original payload.

如果您不想将每个浓缩器的结果放入vars中,则可以将它们添加到消息有效负载本身中.如果有效负载是map实例或带有setter的pojo实例,则可以简单地添加一个浓缩器结果,如下所示:

If you didnt want to put the results of each enricher in vars, you could add them to the message payload itself. If the payload is an instance of map or a pojo with a setter, you can simply add an enrichers result as in:

 <enricher source="#[message.payload]" target="#[message.payload.enricherResult]" doc:name="Message Enricher">

如果您想使有效载荷保持原始状态,可以将其作为键原始"或其他内容移动到地图中,然后将每个浓缩器结果添加为新键.

If you wanted to keep the payload original, you could move it into a map as key "original" or something and then add each enrichers result as a new key.

无论哪种方式,您打算保留每个浓缩器结果的事实可能意味着无论您将它们放入flowVars还是将其填充到有效负载本身中,使用的内存量都是相同的.

Either way, the fact that you plan to hold on to each enrichers result probably means the same amount of memory is being used whether you put them in flowVars or stuff them into the payload itself.

这篇关于在执行flow子流程期间维护有效负载状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆