2014-05-03 37 views
0

我有一條路線:駱駝代理動態url參數設置

從路由是REST呼叫。

from("http://com.containerhost:8080/"). 
    .setHeader("param3",param3) 
    .to(anotherURL?queryparam1="queryparam1ofRESTCALL"&queryparam2="queryParam2ofRESTCall"&queryparam3=${header.param3}") 

但是,駱駝不認識這個參數3,即使它設置在標題中。在我的情況下,參數3是一個關鍵。只能添加到TO uri中,而不應該暴露給FROM Uri Rest call。所以請告訴我如何在這種情況下動態添加多個參數。當我通過論壇時,他們告訴我看看進入recepient list.But無法從駱駝得到很多信息http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html我不知道如何使用Recepient列表。如果你能給我一些投入,它會有很大的幫助。感謝致敬。

回答

1

簡單的收件人列表是動態的。只要做到:

.recipientList(simple("anotherURL?queryparam1=queryparam1ofRESTCALL 
         &queryparam2=queryParam2ofRESTCall 
         &queryparam3=${header.param3}")); 
+0

爲什麼駱駝沒有設計爲使用動態'to'?這會更明顯(至少對我而言)。 –

1

或者到recipientList模式,你可以只設置Exchange.HTTP_QUERY頭:

exchange.getIn().setHeader(Exchange.HTTP_QUERY, "...");