Migrate documentation to Antora

Issue #4422
This commit is contained in:
Rob Winch
2023-07-20 17:07:16 -05:00
committed by Mahmoud Ben Hassine
parent e36a44788d
commit 2e8d5063f7
149 changed files with 9472 additions and 9114 deletions

View File

@@ -0,0 +1,60 @@
[[chunkOrientedProcessing]]
= Chunk-oriented Processing
Spring Batch uses a "`chunk-oriented`" processing style in its most common
implementation. Chunk oriented processing refers to reading the data one at a time and
creating 'chunks' that are written out within a transaction boundary. Once the number of
items read equals the commit interval, the entire chunk is written out by the
`ItemWriter`, and then the transaction is committed. The following image shows the
process:
.Chunk-oriented Processing
image::chunk-oriented-processing.png[Chunk Oriented Processing, scaledwidth="60%"]
The following pseudo code shows the same concepts in a simplified form:
[source, java]
----
List items = new Arraylist();
for(int i = 0; i < commitInterval; i++){
Object item = itemReader.read();
if (item != null) {
items.add(item);
}
}
itemWriter.write(items);
----
You can also configure a chunk-oriented step with an optional `ItemProcessor`
to process items before passing them to the `ItemWriter`. The following image
shows the process when an `ItemProcessor` is registered in the step:
.Chunk-oriented Processing with Item Processor
image::chunk-oriented-processing-with-item-processor.png[Chunk Oriented Processing With Item Processor, scaledwidth="60%"]
The following pseudo code shows how this is implemented in a simplified form:
[source, java]
----
List items = new Arraylist();
for(int i = 0; i < commitInterval; i++){
Object item = itemReader.read();
if (item != null) {
items.add(item);
}
}
List processedItems = new Arraylist();
for(Object item: items){
Object processedItem = itemProcessor.process(item);
if (processedItem != null) {
processedItems.add(processedItem);
}
}
itemWriter.write(processedItems);
----
For more details about item processors and their use cases, see the
xref:processor.adoc[Item processing] section.