Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

retry can't use in reader? [BATCH-2643] #960

Closed
spring-issuemaster opened this issue Oct 13, 2017 · 0 comments
Closed

retry can't use in reader? [BATCH-2643] #960

spring-issuemaster opened this issue Oct 13, 2017 · 0 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Oct 13, 2017

lly835 opened BATCH-2643 and commented

throw exception in reader

    @Bean
    @StepScope
    public FlatFileItemReader<Person> reader() {

        FlatFileItemReader<Person> reader = new FlatFileItemReader<Person>();
        reader.setResource(new ClassPathResource("sample-data.csv"));
        reader.setLineMapper(new DefaultLineMapper<Person>() {{
            setLineTokenizer(new DelimitedLineTokenizer() {{
                setNames(new String[] { "firstName", "lastName" });
            }});
            setFieldSetMapper(new BeanWrapperFieldSetMapper<Person>() {{
                setTargetType(Person.class);
            }});
        }});
//        return reader;
        throw new RuntimeException("error...");
    }

use retry in step

@Bean
public Step step1(PersonItemProcessor processor, ItemReader reader) {
    return stepBuilderFactory.get("step1")
            .<Person, Person> chunk(10)
            .reader(reader)
            .processor(processor)
            .faultTolerant()
            .retryPolicy(new AlwaysRetryPolicy())
            .writer(writer())
            .build();
}

it would not retry


Affects: 3.0.7

Issue Links:

  • BATCH-2562 Retry not working with FaultTolerantStepBuilder
    ("duplicates")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.