Can Spring Batch jobs be configured at run time with dynamic steps?

一世执手 提交于 2019-12-06 08:00:34

the job configuration itself is set before the job runs, but it is possible to create a flexible job configuration with conditional flows

you can't just change the job configuration while the job runs, but between jobs its easy to replace the configuration

Addon for Michael answer:

Do you want to create a flow from beginning to end completely dynamically or you want to have some dynamics at certain point?

  1. As Spring Batch instantiates jobs (will all internals) from XML configuration, that means all necessary beans have setters/getters and you can create the Job from empty page. This is long and bug-prone way (you need to create FlowJob as in JobParserJobFactoryBean goes, then SimpleFlow then StepState then TaskletStep as in SimpleStepFactoryBean and bind them together).
  2. I think the alternative to XML flows could be your coded logic. For String Batch it will look as one step, but with custom implementation and subflow. See <tasklet ref="myCleverTasklet" /> example in Example Tasklet Implementation.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!