Grails插件支持Spring批量拆分流程?

时间:2013-08-09 09:48:13

标签: spring grails spring-batch grails-plugin

我正在为Grails使用Spring批处理插件(spring-batch-1.0.RC2)。到目前为止工作正常,但我想拆分流程执行...是否支持?这是我试图执行的代码......但结果是Step1,Step2,Step3,Step 4。

beans {
  xmlns batch:"http://www.springframework.org/schema/batch"

  jobLauncher(org.springframework.batch.core.launch.support.SimpleJobLauncher){
     jobRepository = ref("jobRepository")
     taskExecutor = bean(org.springframework.core.task.SimpleAsyncTaskExecutor)
     taskExecutorParallel = bean(org.springframework.core.task.SimpleAsyncTaskExecutor)
  }

  batch.job(id: 'endOfDayJob') {
     batch.step(id: 'logStart', next:'createContext') {
        batch.tasklet(ref: 'printStartMessage')
     }

  batch.step(id: 'createContext', next:'split1') {
    batch.tasklet(ref: 'context')
  }

  batch.split(id: 'split1',taskexecutor:'taskExecutorParallel', next:'logFinish'  ) {
    batch.flow{ 

       batch.step(id:'step1Id', next:'step2Id'){
            batch.tasklet(ref: 'step1')
        }           
        batch.step(id: 'step2Id') {
            batch.tasklet(ref: 'step2')
        }
    }
    batch.flow{
        batch.step(id:'step3Id', next:'step4Id'){
            batch.tasklet(ref: 'step3')
        } 
        batch.step(id: 'step4Id') {
            batch.tasklet(ref: 'step4')
        }
    }
  }

  batch.step(id: 'logFinish') {
    batch.tasklet(ref: 'printEndMessage')
  }
}

谢谢!

1 个答案:

答案 0 :(得分:0)

我明白了...它得到了支持......我在这一行中犯了一个错误:

batch.split(id: 'split1','task-executor':'taskExecutorParallel', next:'logFinish'  ) {