Results 1 to 3 of 3

Thread: Custom skip policy

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Default Custom skip policy

    Hi,

    When implementing a batch a requirement is to allow a percentage of items to skip before failing the job as a whole. Additionally I should not even consider this test until I pass a certain threshold, i.e. if the first record fails, that's a 100% failure rate .... until the second record is processed & succeeds etc etc...

    I'm assuming that a custom skip policy is the way forward here. However whilst I can see that it'd be a simple task to implement this based on a fixed number of items I cannot see how I can get the number of items processed or saved dynamically.

    Ideally I'd like to know how many items I've processed / saved on entering my custom skip policy so that I can work out my % failure rate.

    Hope that makes sense, any help greatly appreciated.

  2. #2

    Default

    How about implementing a StepExecutionListener?

    @AfterStep
    public ExitStatus afterStep(StepExecution stepExecution) {
    if(stepExecution.getReadCount() > 0) {
    log.info(" Step Summary: " + stepExecution.getSummary());
    return stepExecution.getExitStatus();
    } else {
    return ExitStatus.FAILED;
    }
    }


    Step Summary: StepExecution: id=0, version=2, name=fixedLengthStep1, status=COMPLETED, exitStatus=COMPLETED, readCount=5, filterCount=0, writeCount=5 readSkipCount=1, writeSkipCount=0, processSkipCount=0, commitCount=1, rollbackCount=0

    I think the step summary might provide you with the counts you need to work out your failure rate. Once the rate hits a certain point then return an ExitStatus.FAILED;

    Jeff

  3. #3
    Join Date
    Jul 2012
    Posts
    2

    Default

    Not a bad idea!

    I'll try heading off down this route.

    Cheers!

Posting Permissions

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