【发布时间】:2019-02-26 12:22:27
【问题描述】:
我的流程在数据库中配置,我的程序不断创建和销毁流程。
因此可以随时更改流程配置(例如 cron 配置)。
流使用方法IntegrationFlowContext.register注册并使用方法IntegrationFlowRegistration.destroy销毁。
流的运行从第 0 秒开始,可以在任何分钟。销毁和创建新流程每分钟从 1 秒开始。
这是一个好方法吗?当我对此进行测试时,它可以工作。但我在想,这是一个很好的方法吗,因为一些流可以在它被销毁的同时运行。
伪代码例如
-at 13pm 00 minutes 00 seconds
-run the flow for the customer X
-at 13pm 00 minutes 01 seconds
-destroy all the flows (including the customer flow X)
-register all the flows (including the customer flow X)
-at 13pm 01 minutes 01 seconds
-destroy all the flows (including the customer flow X)
-register all the flows (including the customer flow X)
-at 13pm 02 minutes 01 seconds
-destroy all the flows (including the customer flow X)
-register all the flows (including the customer flow X)
...
-at 13pm 59 minutes 01 seconds
-destroy all the flows (including the customer flow X)
-register all the flows (including the customer flow X)
-at 14pm 00 minutes 00 seconds
-run the flow for the customer Y
-at 14pm 00 minutes 01 seconds
-destroy all the flows (including the customer flow Y)
-register all the flows (including the customer flow Y)
编辑:
这是必需的,因为如果数据库中的配置发生更改,我不想重新启动服务器。我在想这是一个好方法还是我应该改变它。
编辑 2:
我可以简化我的问题。如果在运行时使用IntegrationFlowRegistration.destroy方法删除了一些流,有什么问题吗?
编辑 3:
我发现流在运行时不能用IntegrationFlowRegistration.destroy方法删除。如果有多个流同时运行,则某些流不会运行到最后。
有什么方法可以检测某个流程是否正在运行?我查看了IntegrationFlowRegistration 类和其他一些类,但没有找到合适的方法。
【问题讨论】:
-
请回答我的编辑 3.
标签: spring-integration spring-integration-dsl