答案 0 :(得分:0)
有效载荷在脚本组件中自动以关键字payload
的形式提供:
<scripting:execute engine="JavaScript" doc:name="Execute">
<scripting:code >var x = payload;</scripting:code>
</scripting:execute>
要使脚本与mule内部关键字脱钩,可以传递参数列表,而不是以key:value对的dataweave映射的形式传递:
<scripting:execute engine="JavaScript" doc:name="Execute">
<scripting:code >var x = myVar;</scripting:code>
<scripting:parameters ><![CDATA[#[{'myVar': payload}]]]></scripting:parameters>
</scripting:execute>