Spring batch skip正在发生,但为什么要重复那个块?

1wnzp6jl  于 5个月前  发布在  Spring
关注(0)|答案(1)|浏览(40)

在spring batch中使用此配置时,DataNotFoundException步骤块被执行3次,这是我配置的,并且是预期的。

但当skip中指定的其他异常发生时,它正在跳过,但执行两次后,为什么?

即使我删除重试和重试限制跳过发生,但重复的块,我不知道为什么?
Sping Boot 版本3.1.5
Spring Cloud版本2022.0.4

@JobScope
    @Bean
    public Step batchUpdateStep(JobRepository jobRepository, PlatformTransactionManager transactionManager,
                                    @Qualifier("batchUpdateItemWriter")
                                    ItemWriter<UpdateRequest> batchUpdateItemWriter,
                                    @Qualifier("batchUpdateItemProcessor")
                                    ItemProcessor<UpdateDto, UpdateRequest> batchUpdateItemProcessor) {
        return new StepBuilder("batch-update-step", jobRepository)
                .<UpdateDto, UpdateRequest>chunk(batchUpdateChunkSize, transactionManager)
                .reader(batchUpdateItemReader(null))
                .processor(batchUpdateItemProcessor)
                .writer(batchUpdateItemWriter)
                .faultTolerant().skipLimit(Integer.MAX_VALUE)
                .skip(Exception.class)
                .noSkip(DataNotFoundException.class)
                .retryLimit(3)
                .retry(DataNotFoundException.class)
                .listener(getBatchUpdateStepListener())
                .listener(getBatchUpdateSkipListener(null, null))
                .listener(batchUpdateProcessListener(null, null))
                .build();
    }

字符串

quhf5bfb

quhf5bfb1#

你有没有试过用你添加noSkip的方法添加noRetry
Javadoc从这个方法:
显式请求从重试中排除异常(和子类)。

相关问题