我想在我的過程方法中設置一些屬性,但我無法弄清楚如何在xml中使用這些屬性,就像我可以輕鬆地在xml中使用標題值使用語法:$ {} in.header.myKey駱駝 - 在春季使用財產DSL
這裏是我的代碼:
<route>
<from uri="activemq:queue:start.queue" />
<to uri="stream:out" />
<process ref="jsonProcessor"></process>
<to uri="bean:validateInputIdentifiers?method=validation(${in.property.SourceMap}, ${in.property.DestinationMap})" />
</route>
這裏in.property.SourceMap是未知的功能。什麼是正確的方法? 如果它是類似於標題的話,它會很棒。此外,我想僅使用屬性而不是標題,因爲標題的值可能不會在我的路線中保留。
這裏的處理方法的代碼:
@Override
public void process(Exchange exchange) throws Exception {
List<Map<String, String>> body = exchange.getIn().getBody(List.class);
Map<String, String> sourceMap = body.get(0);
Map<String, String> destinationMap = body.get(1);
exchange.setProperty("SourceMap", sourceMap);
exchange.setProperty("DestinationMap", destinationMap);
}
請提供瞭解決方案。