Spring 集成:轮询 HTTP [英] Spring Integration: Poll HTTP
本文介绍了Spring 集成:轮询 HTTP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Spring Integration 轮询 HTTP Web 服务.
How can I poll a HTTP web service using Spring Integration.
<int-http:outbound-gateway request-channel="in" reply-channel="out"
url="http://whatever.com" http-method="GET"
expected-response-type="java.lang.String"/>
http 出站网关不支持像 Twitter 那样的轮询器.
The http outbound gateway doesn't support poller like the Twitter one.
当然可以创建一个虚拟网关来发送空消息并使用任务调度程序进行配置.
Of course there is the possibility to create a dummy gateway to send empty messages and to configure this using a task scheduler.
推荐答案
实际上,创建一个inbound-channel-adapter
是一个非常干净和不错的解决方案,就像这样
Actually it is a pretty clean and nice solution to create an inbound-channel-adapter
, like this
<int:inbound-channel-adapter id="in" expression="''" auto-startup="true" >
<int:poller cron="* */30 * * * *" max-messages-per-poll="3" />
</int:inbound-channel-adapter>
上面的将自动启动(默认行为,无论如何)并每 30 秒轮询一次.
The above one will automatically start(default behavior, anyway) and poll every 30 seconds.
这篇关于Spring 集成:轮询 HTTP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文