Announcement Announcement Module
Collapse
No announcement yet.
Problem with Job and Steps Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment

    Working...
    X