我需要创建一个小型的Spring Integration应用程序,将JDBC源代码表与另一个表同步,我只需要偶尔启动一次该脚本 .
我想从入站通道适配器进行一次轮询(等待消息流经链)并退出应用程序 .
我找不到任何明显的方法:任何建议?
@Steve建议正确的解决方案 .
您应该使 <poller> 与一些长 fixed-delay 不启动新的轮询任务 . 或者在轮询任务运行后立即停止 <inbound-channel-adapter> . 为此目的,只需将 channel 设为 <publish-subscribe-channel> 并再添加一个订阅者:
<poller>
fixed-delay
<inbound-channel-adapter>
channel
<publish-subscribe-channel>
<outbound-channel-adapter channel="processChannel" expression="@adapter.stop()">
那么,这是第一部分:如何只制作单个 poll ?
poll
回覆 . System.exit() .
System.exit()
您应该在流程的末尾添加类似的 outbound-channel-adapter :
outbound-channel-adapter
<outbound-channel-adapter channel="endProcessChannel" expression="T(System).exit()">
1 回答
@Steve建议正确的解决方案 .
您应该使
<poller>
与一些长fixed-delay
不启动新的轮询任务 . 或者在轮询任务运行后立即停止<inbound-channel-adapter>
. 为此目的,只需将channel
设为<publish-subscribe-channel>
并再添加一个订阅者:那么,这是第一部分:如何只制作单个
poll
?回覆 .
System.exit()
.您应该在流程的末尾添加类似的
outbound-channel-adapter
: