Announcement Announcement Module
Collapse
No announcement yet.
Some questions Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some questions

    Hi everybody,
    I am new in SpringBatch and I have read some docs about it. I understood a few things about it and I have a few questions.Here are my questions:

    1- Is there a possibility of storing data somewhere if an error occurs while processing a step? (here I mean the data loaded from a Database for example not the step context data). If it's possible how can we configure or program that?

    2-If we want to launch a batch via our command line manually, is it possible to specify parameters in order to make our batch proceed between date1 and date2 for example?
    i
    3-What are the parameters that we can give to a step execution ?

    4- I tried something and it didn't work
    <batch:job id="myjob">
    <batch:step id="stepA" next="stepB" />
    <batch:step id="stepB" next="stepA" />
    </batch:job>

    I would like to know why this job doesn't work like this : stepA --> stepB-->stepA--stepB .......

    Actually it executes stepA then stepB and ends . I would like to know why?

    Thanks for any help.

    PS: besides SpringBatch official site and the reference guide I would be thankful if anyone gives me any other relevant links, tutorials, examples or whatever that can help me in my work with SpringBatch.

  • #2
    1) sure, you can do whatever custom logging you want, heres a possible example from the docs: http://static.springsource.org/sprin...ingAndFailures

    2) if your using CommandLineJobRunner you pass the job name and params -- possibly pass in your dates as params to that job that way

    3) not sure i follow this but you should be able to use standard spring injection to set things into tasklets / custom reader/writers/etc

    4) id guess because step A is marked as complete and allow-start-if-complete isn't true

    you can find a number of examples in the spring batch distro

    Comment


    • #3
      Hi Mr. Chris,
      do you have any example of passing dates as params ?

      Comment


      • #4
        from the documentation:

        bash$ java CommandLineJobRunner endOfDayJob.xml endOfDay schedule.date(date)=2008/01/01

        Comment


        • #5
          Thank you Chris,

          For the first 3 questions, it's OK, but for the last one, what you seggested, namely allow-start-if-complete sat at true, works as follows: stepA, StepA, stepA indefinetly and it's not what I want. But thank you anyway for your help. If anybody has more information , please share it.

          Comment


          • #6
            this config:

            Code:
              <job id="testJob">
                <step id="logMessage" next="logNextMessage">
                  <tasklet ref="logMessageTasklet" allow-start-if-complete="true"/>
                </step>
                <step id="logNextMessage" next="logMessage">
                  <tasklet ref="logMessageTasklet" allow-start-if-complete="true"/>
                </step>
              </job>
            for me, using batch 2.1.0.RELEASE results in:

            logMessage -> logNextMessage -> logMessage -> logNextMessage in an endless loop

            that seems like what you want, no?

            if so, you will get warnings about duplicate steps, see for more info: https://jira.springsource.org/browse/BATCH-1434

            Comment


            • #7
              Thank you chris,
              that's what I want, Iwill try it and let you know

              Comment


              • #8
                Hi Chris,

                Your suggestion is working. Thank you.

                Comment

                Working...
                X