Detail and Summarize in a Single Pipeline
This section describes a scenario where you have a single input file (or stream) and wish to perform multiple streams of work with it in parallel.
The following example takes an input CSV stream and converts the detail records to XML in one job, while using the GroupByReader
to
summarize it in another job.
Both jobs run asynchronously, but the splitting happens in the main thread. If you need the splitting to run in a separate thread,
either call its runAsync()
method or pass it as a Runnable
to a new Thread
or ExecutorService
.
You can read more about the DeMux splitter class in the multi-threading section Reading One-to-Many Asynchronously.