【发布时间】:2015-03-12 10:00:01
【问题描述】:
我的目标是让弹簧集成轮询器在发生多个异常时退出轮询。
我配置了以下出站通道适配器
<int:outbound-channel-adapter id="adapter" ref="handler"
method="handle" channel="channel" >
<int:poller max-messages-per-poll="50" fixed-delay="13"
time-unit="SECONDS" task-executor="threadpool">
<int:transactional synchronization-factory="mySyncFactory"
transaction-manager="simpleJdbcTransactionManager"
timeout="30"/>
</int:poller>
</int:outbound-channel-adapter>
现在我想添加另一个建议(电路断路器)。为此,我必须删除 int:transactional-tag 并添加一个建议链。我可以这样写
<int:outbound-channel-adapter id="adapter" ref="handler"
method="handle" channel="channel" >
<int:poller max-messages-per-poll="50" fixed-delay="13"
time-unit="SECONDS" task-executor="threadpool">
<int:advice-chain>
<tx:advice transaction-manager="simpleJdbcTransactionManager">
<tx:attributes>
<tx:method name="*" timeout="30000" />
</tx:attributes>
</tx:advice>
<int:ref bean="cuircuitBreaker"/>
</int:advice-chain>
</int:poller>
</int:outbound-channel-adapter>
我找不到为 tx-advice 声明同步工厂的可能性。关于如何实现这一点的任何提示?
更新 我正在使用弹簧集成版本 3.0.4
【问题讨论】: