spring integration outbound gateway rest ws从响应头读取http_statusCode

时间:2015-10-04 13:30:15

标签: spring-integration

我的应用程序的配置如下:

    <int:inbound-channel-adapter channel="quakeinfotrigger.channel"
    expression="''">
    <int:poller fixed-delay="60000"></int:poller>
</int:inbound-channel-adapter>

<int:channel id="quakeinfo.channel">
    <int:queue capacity="10" />
</int:channel>

<int:channel id="quakeinfotrigger.channel"></int:channel>

<int-http:outbound-gateway id="quakerHttpGateway"
    request-channel="quakeinfotrigger.channel" 
    url="http://fff.com/rest/objects"
    http-method="POST"
    expected-response-type="java.lang.String"
    charset="UTF-8"
    reply-timeout="5000"
     reply-channel="quakeinfo.channel">
</int-http:outbound-gateway>

我需要根据响应头上的http_statusCode处理错误。你能告诉我在我的代码中拦截它吗? 感谢

1 个答案:

答案 0 :(得分:0)

这取决于你想要做什么。

有很多方法可以使用标题,例如:

您可以订阅<router/>quakeinfo.channel并根据标头值进行路由。

您可以使用服务激活器......

<service-activator input-channel="quakeinfo.channel" ref="foo" method="handle" />

public class Foo {

    public void handle(@Header("http_statusCode") HttpStatus statusCode) {
        ...
    }
}
相关问题