I am fairly new to Spring batch framework.
I am trying to read about 1 million records in reader with commit-interval=10000
and in writer I need to do 2 things with the List of items.
I am thinking these two tasks can be run in parallel, rather than writing sequential java code in writer class.
What should be the best way to have two writers that operate in parallel and do their own tasks?
You have several options.
option 1:
disadvantages:
option 2:
instead of trying to run the writing to the file and db in parallel, make your chunks run in parallel:
advantage:
disadvantages:
option 3:
forget about parallelism: writing to a file is a lot faster than writing to a db, so the overhead shouldn't have a significant impact. Just use a composite writer configured with your db- and filewriter.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.