Results 1 to 2 of 2

Thread: Multi-threaded ItemProcessor

  1. #1
    Join Date
    Aug 2011
    Posts
    20

    Default Multi-threaded ItemProcessor

    Multi-threaded steps will execute the whole step (ItemReader, ItemProcessor and ItemWriter) in parallel. This is often problematic because ItemReaders and ItemWriters are not thread-safe, and even when you make them thread-safe you loose record ordering and restartability if you don't resort to a process indicator pattern using a DB. But the ItemProcessor part of the step could in theory be done multi-threaded, while ItemReader and ItemWriter stay single-threaded. Is this possible in spring batch?

    I also have a second question that is also related to ItemProcessor: in another batch job I need to call a webservice in the ItemProcessor, but this webservice provides a bulk interface, so I don't want to invoke it for every item, but rather I want to invoke it for the complete chunk. Is this possible?

    Thanks in advance.

  2. #2
    Join Date
    May 2011
    Location
    New Delhi, India
    Posts
    157

    Default

    I am not very sure if making only the processor multithreaded is possible.
    Regarding your second query, you should call the web service in the writer as the complete chunk will be availaible. This is the recommended approach for processing chunk of items.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •