我有一个 Spring Integration 路由(通过 DSL 制作),它从特定文件夹(如 Polling from file using Java DSL - compile error when adding Files.inboundAdapter 所示)轮询文件并将其发送到 Rabbit。
当我按照上面链接中的说明配置流程时,它已经在配置阶段启动。然而,我想稍后在运行时启动它,因为我需要先连接到 Rabbit。
如何将 IntegrationFlow 配置为稍后按需启动/停止?
最佳答案
添加autoStartup(false)
。
e -> e.poller(Pollers.fixedDelay(5000))
.autoStartup(false)
然后当你准备好时flow.start()
。
关于java - 按需启动 Spring Integration 路由,而不是在上下文初始化期间启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44629928/