2013-09-28 21 views
1

我是Spring和Spring集成的新手,我決定用雙腳跳入 - 現在,我被卡住了。已篩選郵件的HTTP響應

考慮下面的Spring的配置 - 在入站網關發送請求到AMQP代理進行處理:

<int:channel id="requestChannel" /> 
<int:channel id="responseChannel"/> 
<int:channel id="myDiscardChannel"/> 
<int-http:inbound-gateway id="myInboundGateway" 
          request-channel="requestChannel" 
          reply-channel="responseChannel" 
          mapped-request-headers="*" 
          mapped-response-headers="Return-Status, Return-Status-Msg, HTTP_RESPONSE_HEADERS"  
          path="/foo" 
          reply-timeout="50000"/> 

<int:chain input-channel="requestChannel" output-channel="responseChannel"> 
    <int:filter expression="someExpression" discard-channel="myDiscardChannel" /> 
    <int-amqp:outbound-gateway amqp-template="amqpTemplate" exchange-name-expression="fooexchange" reply-timeout="50000" /> 
</int:chain>   

我想什麼能夠做到當做作「someExpression」表達evaulates是假的對於表示HTTP請求的消息,請使用適當的HTTP狀態代碼和有效內容完成原始請求。

我已經看了幾個途徑:

1)設置過濾器來生成異常,並在錯誤通道處理它們,但我似乎無法得到這個權利 - 這種技術的一個適當的例子一直很難找到。

2)設置過濾器將丟棄的消息發送到丟棄通道 - 我還沒有想出如何生成消息並將消息發回給將完成原始請求的入站網關。

任何幫助將不勝感激!

回答

2

只需將變壓器訂購到放棄通道;省略變壓器上的輸出通道,轉換後的結果將回到入站網關。

您可以從入站網關和鏈路(輸出通道)中刪除responseChannel(回覆通道)。在這種情況下不需要。

+0

謝謝加里 - 這確實「只是那麼簡單!」。 – Bukes