spring 集成出站网关 rest ws 从响应头中读取 http_statusCode
spring integration outbound gateway rest ws read http_statusCode from response header
我的应用程序配置如下:
<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处理错误。你能告诉我在我的代码中拦截它吗?
谢谢
这完全取决于你想做什么。
header的使用方法有很多种,例如:
您可以将 <router/>
订阅到 quakeinfo.channel
并根据 header 值进行路由。
您可以使用服务激活器...
<service-activator input-channel="quakeinfo.channel" ref="foo" method="handle" />
和
public class Foo {
public void handle(@Header("http_statusCode") HttpStatus statusCode) {
...
}
}
我的应用程序配置如下:
<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处理错误。你能告诉我在我的代码中拦截它吗? 谢谢
这完全取决于你想做什么。
header的使用方法有很多种,例如:
您可以将 <router/>
订阅到 quakeinfo.channel
并根据 header 值进行路由。
您可以使用服务激活器...
<service-activator input-channel="quakeinfo.channel" ref="foo" method="handle" />
和
public class Foo {
public void handle(@Header("http_statusCode") HttpStatus statusCode) {
...
}
}