2016-06-21 76 views
0

我正在使用Apache Camel版本2.15.1。我的路線有一個分割器,它將塊分割成塊,每塊都保存到數據庫中。我想記錄這條路線的進展情況。不幸的是CamelSplitIndex頭是基於0的,我該如何使用XML DSL來做「+ 1」?駱駝分配器XML DSL如何記錄消息索引

<route id="insertInDb"> 
    <from uri="direct:listOfDataInBodyArrivesHere" /> 
    <split> 
     <simple>${body}</simple> 
     <log message="Insert ${header.CamelSplitIndex} of ${header.CamelSplitSize}" /> 
     <to uri="mybatis:insertData?statementType=Insert" /> 
    </split> 
    <log message="Insert done" /> 
</route> 

輸出是

的3
插入0的3
插入的3

2我期望的輸出是

插入1插入1 3
插入3
插入的3

3 2如何達到預期的輸出?我試着用${header.CamelSplitIndex++}沒有結果。

回答

2

我認爲應該是${header.CamelSplitIndex}++

+0

謝謝,它的工作原理!注意,這個一元運算符可以從Camel ** 2.9 ** –