私はラク1のラクダ交換のプロパティを設定しています。私はスプリッタの中の2番目のルートを同じものに更新しようとしています。スプリッタの2番目の反復では、新しい更新された値の代わりにルート1に設定した元の値を取得しています。キャメルの交換の性質を更新できません
public void setMyProperty(Exchange exchange) {
exchange.setProperty("testProp", "hello");
}
public void setProperty(Exchange exchange) {
sysout(exchange.getProperty("testProp").toString())//this always prints "hello"
String x=exchange.getProperty("testProp")+some other value;// in all iterations of split I am getting 'hello' as the value of the property instead of new value
exchange.setProperty("testProp", x);
sysout(exchange.getProperty("testProp").toString())// this line prints the new value
}
プロパティが更新されないのはなぜ:以下は私が...豆インサイド
<route handleFault="true" streamCache="true" id="route1">
<from uri="cxfrs://bean://test?synchronous=true"/>
<bean ref="testBean" method="setMyProperty"/>// setting initial value for property
<to uri="direct:directCall"/>
</route>
<route handleFault="true" streamCache="true" id="route2">
<from uri="direct:directcall"/>
<log message="Inside Second call..."/>
<split>
<jsonpath>some Json path</jsonpath>
<bean ref="formatConvertor" method ="convertLHMToJSON(${body})"/>
<split>
<jsonpath>some json path</jsonpath>
<bean ref="PropertySetter" method ="setProperty"/> //I am setting new value in this method
</split>
</split>
をしようとしているサンプルはありますか?私はヘッダーを設定しようとしました。同じ結果。ありがとうございました。
なぜあなたは交換プロパティを設定するためにBeanを使用していますか?表示されている以上のロジックがない限り、.setProperty( "propertyName"、 "propertyValue");その後、分割内の同じコードを使用してプロパティを更新することができます。 –
実際、私はプロパティに設定する前に、豆の中に多くの変換を持っています。再び分割の中で私はプロパティを更新する前にビジネスロジックを書く必要があります。 – Jay
あなたが貼り付けたコードを処理できないのはなぜか分かりません。私は前に分割で交換プロパティを更新しています。簡単な例でテストすればよいと思います。 SplitIndexをexchangeプロパティに置き、その値を記録します。各分割中にそのプロパティを見ることができることを確認してください。 –