From 58bbc962d5732cadfc7d77c99f9c49236a5ceea6 Mon Sep 17 00:00:00 2001 From: Mahmoud Ben Hassine Date: Mon, 25 May 2020 23:43:00 +0200 Subject: [PATCH] Polish 1eed5a30c3586bb5e5eedd7930ac1e62ebef6cef * Fix section levels * Fix typos in code examples * Minor updates --- spring-batch-docs/asciidoc/index.adoc | 6 +++--- spring-batch-docs/asciidoc/processor.adoc | 18 +++++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/spring-batch-docs/asciidoc/index.adoc b/spring-batch-docs/asciidoc/index.adoc index 4b13846cd..536304973 100644 --- a/spring-batch-docs/asciidoc/index.adoc +++ b/spring-batch-docs/asciidoc/index.adoc @@ -17,9 +17,9 @@ of the Batch domain language. administration. <> :: Step configuration, different types of steps, controlling step flow. -<> :: Item readers -and writers interfaces and how to use them. -<> :: Item processor interface and how to use it. +<> :: `ItemReader` +and `ItemWriter` interfaces and how to use them. +<> :: `ItemProcessor` interface and how to use it. <> :: Multi-threaded steps, parallel steps, remote chunking and partitioning. <> :: Completion policies and exception handling of repetitive actions. diff --git a/spring-batch-docs/asciidoc/processor.adoc b/spring-batch-docs/asciidoc/processor.adoc index 898aeb95c..bbd61f1a9 100644 --- a/spring-batch-docs/asciidoc/processor.adoc +++ b/spring-batch-docs/asciidoc/processor.adoc @@ -2,14 +2,14 @@ :toc: left :toclevels: 4 -[[processor]] -== ItemProcessor +[[itemProcessor]] +== Item processing ifndef::onlyonetoggle[] include::toggle.adoc[] endif::onlyonetoggle[] -The `ItemReader` and `ItemWriter` interfaces are both very useful for their specific +The <> are both very useful for their specific tasks, but what if you want to insert business logic before writing? One option for both reading and writing is to use the composite pattern: Create an `ItemWriter` that contains another `ItemWriter` or an `ItemReader` that contains another `ItemReader`. The following @@ -117,7 +117,7 @@ public Job ioSampleJob() { @Bean public Step step1() { return this.stepBuilderFactory.get("step1") - .chunk(2) + .chunk(2) .reader(fooReader()) .processor(fooProcessor()) .writer(barWriter()) @@ -129,7 +129,7 @@ A difference between `ItemProcessor` and `ItemReader` or `ItemWriter` is that an is optional for a `Step`. [[chainingItemProcessors]] -==== Chaining ItemProcessors +=== Chaining ItemProcessors Performing a single transformation is useful in many scenarios, but what if you want to 'chain' together multiple `ItemProcessor` implementations? This can be accomplished using @@ -223,7 +223,7 @@ public Job ioSampleJob() { @Bean public Step step1() { return this.stepBuilderFactory.get("step1") - .chunk(2) + .chunk(2) .reader(fooReader()) .processor(compositeProcessor()) .writer(foobarWriter()) @@ -245,7 +245,7 @@ public CompositeItemProcessor compositeProcessor() { ---- [[filteringRecords]] -==== Filtering Records +=== Filtering Records One typical use for an item processor is to filter out records before they are passed to the `ItemWriter`. Filtering is an action distinct from skipping. Skipping indicates that @@ -265,7 +265,7 @@ the `ItemWriter`. As usual, an exception thrown from the `ItemProcessor` results skip. [[validatingInput]] -==== Validating Input +=== Validating Input In the <> chapter, multiple approaches to parsing input have been discussed. Each major implementation throws an exception if it is not 'well-formed'. The @@ -369,7 +369,7 @@ public BeanValidatingItemProcessor beanValidatingItemProcessor() throws ---- [[faultTolerant]] -==== Fault Tolerance +=== Fault Tolerance When a chunk is rolled back, items that have been cached during reading may be reprocessed. If a step is configured to be fault tolerant (typically by using skip or