spring batch - Skip step based on job parameter -


i've read through spring batch docs few times , searched way skip job step based on job parameters.

for example have job

<batch:job id="job" restartable="true"         xmlns="http://www.springframework.org/schema/batch">         <batch:step id="step1-partitioned-export-master">             <batch:partition handler="partitionhandler"                 partitioner="partitioner" />             <batch:next on="completed" to="step2-join" />         </batch:step>         <batch:step id="step2-join">             <batch:tasklet>                 <batch:chunk reader="xmlmultiresourcereader" writer="joinxmlitemwriter"                     commit-interval="1000">                 </batch:chunk>             </batch:tasklet>             <batch:next on="completed" to="step3-zipfile" />         </batch:step>         <batch:step id="step3-zipfile">             <batch:tasklet ref="zipfiletasklet" />             <!-- <batch:next on="completed" to="step4-filecleanup" /> -->         </batch:step>         <!-- <batch:step id="step4-filecleanup">             <batch:tasklet ref="filecleanuptasklet" />         </batch:step> -->     </batch:job> 

i want able skip step4 if desired specifying in job paramaters.

the related question find how select spring batch job run based on application argument - spring boot java config

which seems indicate 2 distinct job contexts should created , decision made outside batch step definition.

i have followed pattern, since had csv export xml in example. split 2 jobs separate spring-context.xml files 1 each export type, though there not many differences.

at point though perhaps cleaner since find no examples of alternatives.

but having create 4 separate context files make possible include step 4 or not each export case seems bit crazy.

i must missing here.

can't decider? http://docs.spring.io/spring-batch/reference/html/configurestep.html (chapter 5.3.4 programmatic flow decisions)


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -