Mule 负载属性值来自流变量 [英] Mule load property value from flow Variable

查看:26
本文介绍了Mule 负载属性值来自流变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,我需要从属性文件中获取值,而我需要获取的值将来自变量.

I have a scenario where i need to get the value from the property file and the values which i need to get will be from a variable.

我的道具文件

org1 =active
org1_oracle_user = blah
org1_oracle_password = blahblah
org2 =active
org2_oracle_user = blah2
org2_oracle_password = blah2blah2
org3 = Active
org3_oracle_user = blah3
org3_oracle_password = blah3blah3

现在我通过一些输入获取组织的价值,并且我能够保存到一些变量中.

Now i'm getting the value of the org through some input and i was able to save into some variable.

<set-variable variableName="org_name" value="org1" doc:name="OrgNameVariable" />

此外,我还可以通过 dataweave 获取该组织是否处于活动状态

Also i'm able to get the status of that org as active or not through dataweave

<set-variable variableName="orgTypeStatus" value="#[dw('p(flowVars.org_name)')]" doc:name="orgTypeStatusVariable" />

我能够检索该值是否处于活动状态

I was able to retrieve the value as active or not

但是现在如何将其他键值附加到流变量 org_name获取他们的用户名和密码

But now how do I append the other key values to flow variable org_name to get thier user and password

 <set-variable variableName="m_user" value="#[dw('p(flowVars.org_name.concat('_oracle_user'))')]" doc:name="user"/>

上面的代码不起作用,它说表达式执行失败.

The above code is not working it says execution of expression fails.

我给出了一个示例,因为还有其他基于组织名称的道具,我无法对其进行硬编码

I have give a sample example as there are other props based on the org name and I cant hard code it

推荐答案

你能试试这个表达吗:-

Can you try this expression:-

#[dw('p(flowVars.org_name ++ "_oracle_user")')]

因此,您需要在表达式中对 "" 进行转义,因此您在 XML 配置中的变量将如下所示:-

So, you need to escape "" in the expression and so your variable in XML config will be as follows:-

<set-variable variableName="m_user" value="#[dw('p(flowVars.org_name ++ &quot;_oracle_user&quot;)')]" doc:name="user"/>

这篇关于Mule 负载属性值来自流变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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