Spring Batch Job Chaining执行不等待Jboss中的上一个作业完成 [英] Spring Batch Job Chaining execution not waiting for previous job to complete in Jboss

查看:92
本文介绍了Spring Batch Job Chaining执行不等待Jboss中的上一个作业完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已按顺序将一组Spring批处理作业链接在一起.

I have chained a set of Spring batch jobs in an order.

<batch:job id="rootJob">
   <batch:step id="rootJob.step1">
     <batch:job ref="externalJob1">
     <batch:next on="COMPLETE" to="rootJob.step2">
   </batch:step>

   <batch:split id="rootJob.step2">
     <batch:flow>
       <batch:step id="splitStep1">
         <batch:job ref="externalJob2">
       </batch:step>
     </batch:flow>
     <batch:flow>
       <batch:step id="splitStep2">
         <batch:job ref="externalJob3">
       </batch:step>
     </batch:flow>
     <batch:next on="COMPLETE" to="rootJob.step3">
   </batch:split>

   <batch:step id="rootJob.step3">
      <batch:job ref="externalJob4">     
   </batch:step>
 </batch:job>

对工作流程执行的期望.

The expectation of job flow execution.

1. On Completion of rootJob.step1 execute rootJob.step2.
2. Execute splitJob1 and splitJob2 in parallel.
3. On Completion of rootJob.step2 execute rootJob.step3

但是在Jboss中部署和触发时.流程未按预期执行.这些步骤一触即发.执行过程不会等待上一步完成并立即启动.

But when deployed and triggered in Jboss. The flow is not executing as expected. The steps are getting triggered in single stretch. The execution is not waiting for previous step to complete and getting launched instantly.

我怀疑TaskExecutor.在独立中,我们未指定任何任务执行器(默认为 SyncTaskExecutor ),并且工作流程正常.但是当部署在Jboss中时,我们使用 SimpleAsyncTaskExecutor ,因为使用SyncTaskExecutor甚至不会触发Jboss中的作业.

I suspect the TaskExecutor. In standalone we do not specify any task executor (defaults to SyncTaskExecutor) and the job flow works fine. But when deployed in Jboss we use SimpleAsyncTaskExecutor, as using SyncTaskExecutor doesnt even trigger job in Jboss.

我在这里想念的东西是什么,或者我在这里做错了什么??请提出建议.

What am i missing here or Am i doing something wrong here.? Please suggest.

推荐答案

解决了该问题.我提供了如下所示的job-launcher ="jobLauncher"属性.因此,启动了单独的线程,并且作业并行触发.

Resolved the issue. I had provided the job-launcher="jobLauncher" property like below. So separate threads were launched and the jobs were triggering in parallel.

  <batch:job ref="externalJob1" job-launcher="jobLauncher">

现在,我已从所有作业中删除了Joblauncher参考,并且作业按设计触发.

Now i have removed the joblauncher reference from all the jobs and the jobs are triggering as designed.

这篇关于Spring Batch Job Chaining执行不等待Jboss中的上一个作业完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆