如何将两个路径变量添加到有效负载表达式



我有带有路径和一个路径变量的入站通道适配器,但现在我想添加第二个变量,但找不到它在有效负载中的外观。

我找到了这个解决方案,但我不希望我的变量在标题中:

<int-http:inbound-gateway id="restCall"
                          request-channel="jobRunner"
                          supported-methods="POST"
                          path="/etl/{jobName}/{currentCustomer}">
    <int-http:header name="jobName" expression="#pathVariables.jobName"/>
    <int-http:header name="currentCustomer"/>
 </int-http:inbound-gateway>

我需要这样的东西:

 <int-http:inbound-gateway id="restCall"
                          request-channel="jobRunner"
                          supported-methods="POST"
                          path="/etl/{jobName}/{currentCustomer}"
                          payload-expression = 
 "#pathVariables.jobName,#pathVariables.currentCustomer">                              
  </int-http:inbound-gateway>

有效负载是单个对象;它不能是两个。

您可以改为将其中一个变量添加到<header/>,也可以创建一些 POJO 并使用

"new com.foo.MyVariableContainer(#pathVariables.jobName, #pathVariables.currentCustomer)"

最新更新