【发布时间】:2015-04-13 06:39:24
【问题描述】:
我正在查看一些基于 spring 集成的代码,我注意到所有 int-http:inbound-gateways 都使用可轮询的请求通道:
<int-http:inbound-gateway id="someId"
request-channel="queue-channel"
reply-channel="reply-channel"
request-payload-type="java.lang.String"
supported-methods="POST"
path="/rest/notifications"
auto-startup="true" />
<int:channel id="queue-channel" datatype="java.lang.String">
<int:queue capacity="100" />
</int:channel>
在配置中指定了一个显式轮询器:
<int:poller id="mainSystemPoller" default="true" fixed-delay="500" max-messages-per-poll="1">
<int:transactional transaction-manager="transactionManager" propagation="REQUIRES_NEW" isolation="DEFAULT"/>
</int:poller>
因此,流向上的第一个通道是可轮询的。使用这种方法有什么好处?它是否只是让我们在业务流程(事务配置、队列容量等)上有更大的灵活性?
【问题讨论】: