Results 1 to 2 of 2

Thread: Problem with Job and Steps

  1. #1
    Join Date
    Aug 2011
    Posts
    16

    Unhappy Problem with Job and Steps

    Hi All

    I have to delete all the records from the DB if there is a file at a given path before processing the record of new file else don't delete the record from DB.

    if(fileExist){
    delete the existing records from a table ABC Then process new file
    }
    else {
    Don't delete the existing records from ABC table.
    }

    Can any one suggest me some solution how to make my job in different steps.

    Below is the piece of code. I am executing my batch through command prompt.

    Code:
    <job id="paymentRecordLoadJob" xmlns="http://www.springframework.org/schema/batch">
    	
    		
    		<step id="paymentRecordLoad" >
    			<tasklet>
    				<chunk reader="paymentRecordReader" writer="paymentRecordWriter" 
    	                   commit-interval="2" skip-limit="10000">
    	                    <skippable-exception-classes>
    			         		<include class="org.springframework.dao.DuplicateKeyException"/>
    			         		<include class="com.abc.pq.batch.exception.PaymentRecordProcessingException"/>
    			      		</skippable-exception-classes>
    			    </chunk> 
    			</tasklet>
    		</step>
    		
    </job>
    Within this job i have to manage that if else condition.

  2. #2
    Join Date
    May 2011
    Location
    New Delhi, India
    Posts
    157

    Default

    You could use the conditional support provided by Spring batch. You can have a step to check the if the file exists, the step can return a status based on this. The subsequent steps can be called based on the returned status.

    http://static.springsource.org/sprin...onditionalFlow

Posting Permissions

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