Results 1 to 2 of 2

Thread: Conditional Flow execution

Hybrid View

  1. #1
    Join Date
    Oct 2011
    Posts
    9

    Default Conditional Flow execution

    Hello,

    I m trying to configure a conditional execution to my spring batch. The requirement says if Step 1 is true goto Step 4 else Step 3.

    <batch:job id="job">
    <batch:step id="step1" next="step2">
    <batch:tasklet>
    <batch:chunk reader="someReader" processor="someProcessor" writer="someWriter"
    </batch:tasklet>
    <batch:next on="true" to="step3" />
    <batch:next on="false" to="step4" />
    </batch:step>
    <batch:step id="step2">
    <batch:tasklet>
    <batch:chunk reader="someReader" writer="someWriter"
    </batch:tasklet>
    </batch:step>
    <batch:step id="step3">
    <batch:tasklet ref="someImpl" />
    </batch:step>
    <batch:step id="step4">
    <batch:tasklet ref="someImpl" />
    </batch:step>
    </batch:job>

    I want to configure above steps for my batch execution. But I m not sure how would I set the routing i.e. "true " or "false" in which class? And if I follow the above configuration would it allow me to route conditionally? If you could please help me with a sample code that would really helpful. I did try to search on the site but I didnt find solution for the above question. I found only ways to configure my job-context.xml.
    Thanks,
    Pooh.

  2. #2

    Default

    i do not understand what true/false means in the context of your job, but as to "how" to do it, please take a look at Spring Batch official documentation: 5.3.2.1. Batch Status vs. Exit Status

Posting Permissions

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