Results 1 to 2 of 2

Thread: how to Skip some of the steps in job

  1. #1
    Join Date
    Jan 2009
    Posts
    4

    Unhappy how to Skip some of the steps in job

    Hi,
    I have a job with the 10 steps inside. for the first time i want to run all the 10 steps and in the second time i want to run only first 5 steps in job.


    How can i implement this . Can you please guide me . or please send me the sample code


    Thanks in advance.
    Suneel.

  2. #2
    Join Date
    Feb 2008
    Posts
    488

    Default

    One nice way to do it could be to use a <decision/> element in your flow. The <decision/> would use a Decider implementation that could read from the JobParameters. Then, when you launched the job, you could pass in a parameter to indicate whether the job should continue.

    This simplified configuration might get you started:
    Code:
    <job>
        <step id="step1" next="step2"/>
        ...
        <step id="step5" next="continueDecision"/>
    
        <decision id="continueDecision" decider="continueDecider">
            <next on="CONTINUE" to="step6"/>
            <end on="END"/>
        </decision>
    
        <step id="step6" next="step7"/>
        ...
        <step id="step10"/>
    </job>
    
    <beans:bean id="continueDecider" class="ContinueDecider" scope="step">
        <beans:property name="shouldContinue" value="#{jobParameters[should.continue]}"/>
    </beans:bean>
    Where the ContinueDecider looks like this:
    Code:
    public class ContinueDecider implements JobExecutionDecider {
        private boolean shouldContinue; //setter omitted
    
        public FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution) {
            if (this.shouldContinue) {
                return new FlowExecutionStatus("CONTINUE");
            }
            else {
                return new FlowExecutionStatus("END");
            }
        }
    }
    Last edited by DHGarrette; May 28th, 2009 at 08:51 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •