简体   繁体   中英

More than one tasklet in a step?

I have a tasklet setting some information into my JobContext, and another one checking some stuff to know if I can execute the next steps in my batch or not. Both tasklets work well if I use two different steps in my job flow, but I'd like to use these two tasklets in the same step.

I tried to add twice ".tasklet(taskletName)" in my batch configuration like this :

return stepBuilderFactory.get("stepSettings").tasklet(taskletSettings).tasklet(taskletChecking).listener(executionContextListener).listener(stepExecutionListener).build();

It doesn't work: only one of the tasklets is executed (it seems to be the second one). I didn't see anything in spring doc ; is there a way to do this ? Or doesn't Spring allow to have more than one tasklet in the same step ?

Only one tasklet for step (I think this is by design).
If you need pre-conditions check to flow your job use a JobExecutionDecider .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM