Announcement Announcement Module
No announcement yet.
Changing the batch status of a STEP. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing the batch status of a STEP.

    I have to change the 'STATUS' of step to 'BatchStatus.FAILED' when the 'EXIT_CODE' of a Step is 'ExitStatus.FAILED'.

    Is there any way to do this?

    Any help would be appreciable.


  • #2
    That would be automatic if the step failed inside the iteration. You can't change the BatchStatus from a StepExecutionListener right now just by modifying the ExitStatus - I ran into that one as well ( Is that what you are trying to do? You can change it directly by modifying the StepExecution I think, as a workaround.
    Last edited by Dave Syer; Mar 31st, 2008, 07:48 AM. Reason: Added workaround


    • #3
      Thanks a lot dave,

      i would rather try to do it by update query on 'batch_step_execution'.


      • #4
        Why would you want to do that? You really should trust the framework to manage the status internally in normal circumstances. Is there a reason why you wouldn't?


        • #5
          I need to re-run the job with same parameters if any step gets failed.

          Because it only allows me to rerun the JOB and STEP if their respective STATUS is 'FAILED', I have to change the STATUS to 'batchStatus.FAILED' if exitSatus of a step is FAILED.

          Is there any other way to do this?



          • #6
            It should be automatic. Your job fails and the status is not FAILED? Can you provide some more details?


            • #7
              I have a job with 5 steps, when any step gets failed it returns the ExitStatus to FAILED.

              On that ExitStatus, i marked the JOB Batch Status 'STATUS' as FAILED.

              But when i run this same instance of JOB, it gives me message that "All steps already completed. No processing was done."


              • #8
                What form did the failure take in the step? Did it throw an exception (if it did then the Job should fail and update the status of the JobExecution as well)?


                • #9
                  Step failed due to exception occur while executing that step.

                  If a Step failed, then only step exitstatus get updated to 'FAILED' and everything else updated as 'COMPLETED'.

                  I also tried JobListener to update the status of that job execution but it only updates the JOBExecution Batch Status and fails to update the Step execution Batch Status.

                  I think, there is a problem with my JobRepository configuration.

                  This is my configuration for job launcher and job Repository,

                  <bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.JobRepositoryFactoryBean">
                  <property name="dataSource" ref="dataSource"/>
                  <property name="databaseType" value="oracle"/>

                  <bean id="jobLauncher" class="org.springframework.batch.core.launch.suppo rt.SimpleJobLauncher">
                  <property name="jobRepository" ref="jobRepository"/>

                  <bean id="jobConfigurationRegistryBeanPostProcessor"
                  <property name="jobRegistry" ref="jobConfigurationRegistry" />

                  <bean id="jobConfigurationRegistry" class="org.springframework.batch.core.configuratio"/>

                  or do i have to use the SimpleJobRepository
                  <bean id="jobRepository" class="org.springframework.batch.core.repository.s upport.SimpleJobRepository">
                  <constructor-arg ref="jobInstanceDao" />
                  <constructor-arg ref="jobExecutionDao" />
                  <constructor-arg ref="stepExecutionDao" />