Announcement Announcement Module
Collapse
No announcement yet.
Repeat steps for a Year end job Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Repeat steps for a Year end job

    Folks:
    I have a use case, where my Year end job should process some data for each month (Jan, Feb, Mar etc).

    Lets say, there are 5 steps in a year end job viz. Step1, Step2, Step3, Step4 and Step5.

    I want to execute Step1-5 for Jan, then for Feb, then for Mar and so on.

    As only month is different in all execution, how can I create a job which would repeat steps for each month.

    First Jan month steps 1-5 should run. Once complete, Feb month steps 1-5 should run and so on.

    I don't want to create 12 jobs.xml file, as only parameter (month) is different between those jobs

    Appreciate your help & direction.

  • #2
    Next state not found in the flow

    Originally posted by Sam2008 View Post
    Folks:
    I have a use case, where my Year end job should process some data for each month (Jan, Feb, Mar etc).

    Lets say, there are 5 steps in a year end job viz. Step1, Step2, Step3, Step4 and Step5.

    I want to execute Step1-5 for Jan, then for Feb, then for Mar and so on.

    As only month is different in all execution, how can I create a job which would repeat steps for each month.

    First Jan month steps 1-5 should run. Once complete, Feb month steps 1-5 should run and so on.

    I don't want to create 12 jobs.xml file, as only parameter (month) is different between those jobs

    Appreciate your help & direction.
    I had a look at loopFlow job example in spring-batch-sample and was able to repeat steps for my job.

    But on completion of job, I am getting following error:
    org.springframework.batch.core.JobExecutionExcepti on: Flow execution ended unexpectedly
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:141)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run Task(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: org.springframework.batch.core.job.flow.FlowExecut ionException: Next state not found in flow=yearEndJob for state=yearEndJob.limitDecision with exit status=COMPLETE
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.nextState(SimpleFlow.java:195)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:158)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:135)


    This is what I have in limitdecider
    <b:decision id="limitDecision" decider="limitDecider">
    <b:next on="CONTINUE" to="step3" />
    <b:end on="COMPLETED" />
    </b:decision>

    I want to repeat step3, step4 and step5 for each month.

    Any hints, what's missing ...?

    Comment


    • #3
      Gotcha ...!!!

      Within my LimitDecider, I have to send exact String
      return new FlowExecutionStatus("COMPLETED");

      I copy pasted the source code from spring-batch-sample.LimitDecider.java and it had return new FlowExecutionStatus("COMPLETE");

      Now its working fine.

      Hope this help someone.

      Comment

      Working...
      X