MuleSoft-在端点内部使用flowVars



我开始使用Mule,有一些琐碎的问题。这里有一个。假设您将url的地址存储在属性文件中,以便稍后在进程中调用。然后您想要使用一个http端点来指定这个url。它运行良好,只需输入地址:${URL_ADRESS}即可。

现在,如果你的url是在flowVar上计算和设置的,为什么下面的代码不起作用?

<http:outbound-endpoint exchange-pattern="request-response" method="GET" address="#[flowVars['URL_ADDRESS']]" doc:name="HTTP"/>

它抛出了这个异常:

java.lang.IllegalArgumentException: Address '#[flowVars['URL_ADDRESS']]' for protocol 'http' should start with http://

为什么在编译时检查它?如何在运行时设置它?

协议不能是动态的。您应该将出站端点更改为
<http:outbound-endpoint exchange-pattern="request-response" method="GET" address="http://#[flowVars['URL_ADDRESS']]" doc:name="HTTP"/>

您应该使用以下格式的流变量。#[FileName]或#[flowVars.FileName]

最新更新