Skip to content

Commit 3da06e5

Browse files
committed
Update whatsnew.adoc for 6.0.0-M2
1 parent c86f636 commit 3da06e5

File tree

1 file changed

+75
-2
lines changed

1 file changed

+75
-2
lines changed

spring-batch-docs/modules/ROOT/pages/whatsnew.adoc

Lines changed: 75 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ Spring Batch 6.0 includes the following features:
77

88
* xref:whatsnew.adoc#dependencies-upgrade[Dependencies upgrade]
99
* xref:whatsnew.adoc#batch-infrastrucutre-configuration-improvements[Batch infrastructure configuration improvements]
10+
* xref:whatsnew.adoc#new-implementation-of-the-chunk-oriented-processing-model[New implementation of the chunk-oriented processing model]
1011
* xref:whatsnew.adoc#new-command-line-operator[New command line operator]
12+
* xref:whatsnew.adoc#ability-to-recover-failed-job-executions[Ability to recover failed job executions]
1113
* xref:whatsnew.adoc#deprecations-and-pruning[Deprecations and pruning]
1214

1315
[[dependencies-upgrade]]
@@ -54,7 +56,7 @@ These classes can be used to configure specific attributes of each job repositor
5456

5557
=== Resourceless batch infrastructure by default
5658

57-
The `DefaultBatchConfiguration` class has been updated to provide a "resourceless" batch infrastructure by default (based on the `ResourcelessJobRepository` implementation introduced in v5.2). This means that it no longer requires an in-memory database (like H2) for the job repository, which was previously necessary for batch metadata storage.
59+
The `DefaultBatchConfiguration` class has been updated to provide a "resourceless" batch infrastructure by default (based on the `ResourcelessJobRepository` implementation introduced in v5.2). This means that it no longer requires an in-memory database (like H2 or HSQLDB) for the job repository, which was previously necessary for batch metadata storage.
5860

5961
Moreover, this change will improve the default performance of batch applications when the meta-data is not used, as the `ResourcelessJobRepository` does not require any database connections or transactions.
6062

@@ -72,6 +74,70 @@ In this release, several changes have been made to simplify the batch infrastruc
7274

7375
This reduces the number of beans required for a typical batch application and simplifies the configuration code.
7476

77+
[[new-implementation-of-the-chunk-oriented-processing-model]]
78+
== New implementation of the chunk-oriented processing model
79+
80+
This is not a new feature, but rather a new implementation of the chunk-oriented processing model. This new implementation was introduced as an experimental addition in version 5.1, and is now available as stable in version 6.0.
81+
82+
The new implementation is provided in the `ChunkOrientedStep` class, which is a replacement for the `ChunkOrientedTasklet` / `TaskletStep` classes.
83+
84+
Here is an example of how to define a `ChunkOrientedStep` by using its builder:
85+
86+
[source, java]
87+
----
88+
@Bean
89+
public Step chunkOrientedStep(JobRepository jobRepository, JdbcTransactionManager transactionManager,
90+
ItemReader<Person> itemReader, ItemProcessor<Person, Person> itemProcessor, ItemWriter<Person> itemWriter) {
91+
int chunkSize = 100;
92+
return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, transactionManager, chunkSize)
93+
.reader(itemReader)
94+
.processor(itemProcessor)
95+
.writer(itemWriter)
96+
.build();
97+
}
98+
----
99+
100+
Moreover, fault-tolerance features were adapted as follows:
101+
102+
- The retry feature is now based on the retry functionality introduced in https://docs.spring.io/spring/reference/7.0/core/resilience.html[Spring Framework 7], instead of the previous Spring Retry library
103+
- The skip feature has been slightly adapted to the new implementation, which is now only based entirely on the `SkipPolicy` interface
104+
105+
Here is a quick example of how to use the retry and skip features with the new `ChunkOrientedStep`:
106+
107+
[source, java]
108+
----
109+
@Bean
110+
public Step faulTolerantChunkOrientedStep(JobRepository jobRepository, JdbcTransactionManager transactionManager,
111+
ItemReader<Person> itemReader, ItemProcessor<Person, Person> itemProcessor, ItemWriter<Person> itemWriter) {
112+
113+
// retry policy configuration
114+
int maxAttempts = 10;
115+
var retrybaleExceptions = Set.of(TransientException.class);
116+
RetryPolicy retryPolicy = RetryPolicy.builder()
117+
.maxAttempts(maxAttempts)
118+
.includes(retrybaleExceptions)
119+
.build();
120+
121+
// skip policy configuration
122+
int skipLimit = 50;
123+
var skippableExceptions = Set.of(FlatFileParseException.class);
124+
SkipPolicy skipPolicy = new LimitCheckingItemSkipPolicy(skipLimit, skippableExceptions);
125+
126+
// step configuration
127+
int chunkSize = 100;
128+
return new ChunkOrientedStepBuilder<Person, Person>(jobRepository, transactionManager, chunkSize)
129+
.reader(itemReader)
130+
.processor(itemProcessor)
131+
.writer(itemWriter)
132+
.faultTolerant()
133+
.retryPolicy(retryPolicy)
134+
.skipPolicy(skipPolicy)
135+
.build();
136+
}
137+
----
138+
139+
Please refer to the https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-6.0-Migration-Guide[migration guide] for more details on how to migrate from the previous implementation to the new one.
140+
75141
[[new-command-line-operator]]
76142
== New command line operator
77143

@@ -81,13 +147,20 @@ Moreover, all these issues made it impossible to reuse that runner in Spring Boo
81147

82148
This release introduces a modern version of `CommandLineJobRunner`, named `CommandLineJobOperator`, that allows you to operate batch jobs from the command line (start, stop, restart and so on) and that is customisable, extensible and updated to the new changes introduced in Spring Batch 6.
83149

150+
[[ability-to-recover-failed-job-executions]]
151+
== Ability to recover failed job executions
152+
153+
Prior to this release, if a job execution fails abruptly, it was not possible to recover it without a manual database update. This was error-prone and not consistent across different job repositories (as it required a few SQL statements for JDBC databases and some custom statements for NoSQL stores).
154+
155+
This release introduces a new method named `recover` in the `JobOperator` interface that allows you to recover failed job executions consistently across all job repositories.
156+
84157
[[deprecations-and-pruning]]
85158
== Deprecations and pruning
86159

87160
As with any major release, some features have been deprecated or removed in Spring Batch 6.0. The following changes are worth noting:
88161

89162
* All deprecated APIs and features from previous versions have been removed
90-
* Modular configurations through `@EnableBatchProcessing(modular = true)` has been deprecated
163+
* Modular configuration through `@EnableBatchProcessing(modular = true)` has been deprecated
91164
* Several APIs have been deprecated in this version, in order to simplify the core API and reduce its scope
92165

93166
Fore more details, please refer to the https://github.com/spring-projects/spring-batch/wiki/Spring-Batch-6.0-Migration-Guide[migration guide].

0 commit comments

Comments
 (0)