2014-11-05 51 views
0

我有10个变量需要通过解析JSON负载来设置,例如#[json:REQUEST_ID]等。可以通过表达式组件完成所有变量,而不是一个接一个地使用Set Variable。我正在寻找如何解析表达式组件中的json负载。非常感谢。表达式组件JSON解析

回答

0

您可以使用邮件 - 属性 - 变压器,简化变量的处理上流动,例如:

<message-properties-transformer doc:name="Message Properties"> 
     <add-message-property key="variableName" value="#[payload.from]" />   
     <add-message-property key="prmts" value="#[org.apache.commons.lang.StringUtils.split(payload.parameters, ';')]" />     
    </message-properties-transformer> 

我希望我可以帮助你;

0

我宁愿一个enricher到消息的属性变压器在这里:

<enricher> 
    <enrich target="#[variable:requestId] source="#[json:REQUEST_ID]" /> 
    <enrich target="#[variable:otherThing] source="#[json:OTHER_THING]" /> 
</enricher>