带有不同参数的春季批次运行相同的工作
我的春季批处理作业在传递某些作业参数时运行。现在,我想实现的是一个超级作业,它构建了作业参数列表,并使用不同的作业参数执行此批处理作业。
我正在使用Joblauncher
使用不同参数触发
作业
java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
。
fun runJobs(jobParams: List<JobParameters>): List<JobExecution> =
jobParams.map { jobParam ->
jobLauncher.run(someJob, jobParam)
}
批处理
I'm having a spring batch job which runs when passed certain job params. Now I wanted to achieve is a super job which constructs list of job params and executes this batch job with different job param.
I'm using jobLauncher
to trigger the batch job using different params
The error am facing is
java.lang.IllegalStateException: Existing transaction detected in JobRepository. Please fix this and try again (e.g. remove @Transactional annotations from client).
The way by which am triggering the job is
fun runJobs(jobParams: List<JobParameters>): List<JobExecution> =
jobParams.map { jobParam ->
jobLauncher.run(someJob, jobParam)
}
Is there an example to trigger same job with different job params programmatically ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此错误意味着您正在尝试在交易范围内启动作业,情况并非如此。似乎
fun runjobs()
用@transactional
或建议以另一种方式进行交易。这是一个快速示例:
This error means you are trying to launch a job within the scope of a transaction, which should not be the case. It seems that
fun runJobs()
is annotated with@Transactional
or is AOP advised to be transactional in another way.Here is a quick example:
我能够使用 JobStep 。
首先创建作业步骤。现在,我们将有一个步骤列表。它们是工作步骤的步骤,需要将它们连接到超级工作,并且它们独立于每个工作。
条件:
abos已经存在或已完成< / code>。
I was able to achieve the same using jobStep.
First create job steps. Now we will have a list of steps. They are steps which are job steps, they need to be wired to a super job and also they are independent of each.
Conditions:
job already exists or completed
.