2014-11-05 50 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>