Announcement Announcement Module
Collapse
No announcement yet.
How to restart a failed step from scratch Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to restart a failed step from scratch

    Hi,

    Please can you'll let me know if it is possible to restart a failed step in a job from scratch.

    For example
    I am using JDBCCursorItemReader to read data from the database and using FlatFileItemWriter to write the data to a file. If the total number of records to be fetched are 1 million but the step fails after reading half a million record due to space issues can I restart the job from scratch. I want that restart of the job should start again from record 1 instead of the point of failure i.e. after half a million record. Is it possible.

    I was reading the documentation and read something about save state in execution context of a step. If I set the saveState to false will resolve my problem.

    Thanks in advance for any suggestions on this.

  • #2
    Hi,

    I am closing the above thread that I started with the below response.

    In case we need to start a step not from the point of failure but right from the start like in my case where a step reads from a file and then write to a file all one needs to do is set the setSaveState to false in both the item readers and item writers.

    Something like the below should work

    final FlatFileItemWriter itemWriter = new FlatFileItemWriter();
    itemWriter.setSaveState(false);

    final JdbcCursorItemReader itemReader = new JdbcCursorItemReader();
    itemReader.setSaveState(false);

    So if a step fails while reading or writing then it will restart from scratch or as if the job was re-run.

    Thanks.

    Comment

    Working...
    X