kamalp
kamalp

Reputation: 11

Spring batch multi threaded asynchItemWriter

I am trying to implement multithreading in spring batch. In my implementation i want

  1. Single multithreaded Reader (As we are reading only one file)
  2. Multi thread processor and writer

I can't implement general chunking as there reader will be multhreded which i don't want.

So next option is asyncItemProcessor/asynchItemWriter. But what i have seen that reader and writer are single threaded only 'asyncItemProcessor' runs in multiple threads in 'asyncItemProcessor/asynchItemWriter.

Is there is anyway where i can run 'Reader' single threaded and processor and writer as multithreaded ?

Upvotes: 0

Views: 373

Answers (1)

Mahmoud Ben Hassine
Mahmoud Ben Hassine

Reputation: 31600

i want

  1. Single multithreaded Reader (As we are reading only one file)
  2. Multi thread processor and writer

Is there is anyway where i can run 'Reader' single threaded and processor and writer as multithreaded ?

You can use a regular non multi-threaded chunk-oriented step with a reader and a AsyncItemProcessor + AsyncItemWriter (those should be used in conjunction) to achieve that.

Upvotes: 1

Related Questions