javatechguy_11232
javatechguy_11232

Reputation: 71

How to specify separate chunkSize for ItemReader and ItemWriter in spring batch?

I'm new to spring batch. Can someone please let me know if there is anyway to set separate chunk sizes or ItemReader and ItemWriter ? If I do the below way, both read and write chunk size is set to 10.

@Bean
public Step sampleStep(PlatformTransactionManager transactionManager) {
        return this.stepBuilderFactory.get("sampleStep")
                                .transactionManager(transactionManager)
                                .<String, String>chunk(10)
                                .reader(itemReader())
                                .writer(itemWriter())
                                .build();
}

Upvotes: 0

Views: 1506

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

That is not possible by design. A chunk oriented step is configured with a single chunk size (commit-interval) which is the same for the entire step. More details about chunk processing in Spring Batch here: https://docs.spring.io/spring-batch/4.0.x/reference/html/step.html#chunkOrientedProcessing

Upvotes: 1

Related Questions