You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* xref:whatsnew.adoc#new-implementation-of-the-chunk-oriented-processing-model[New implementation of the chunk-oriented processing model]
10
11
* 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]
11
13
* xref:whatsnew.adoc#deprecations-and-pruning[Deprecations and pruning]
12
14
13
15
[[dependencies-upgrade]]
@@ -54,7 +56,7 @@ These classes can be used to configure specific attributes of each job repositor
54
56
55
57
=== Resourceless batch infrastructure by default
56
58
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.
58
60
59
61
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.
60
62
@@ -72,6 +74,70 @@ In this release, several changes have been made to simplify the batch infrastruc
72
74
73
75
This reduces the number of beans required for a typical batch application and simplifies the configuration code.
== 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,
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,
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
+
75
141
[[new-command-line-operator]]
76
142
== New command line operator
77
143
@@ -81,13 +147,20 @@ Moreover, all these issues made it impossible to reuse that runner in Spring Boo
81
147
82
148
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.
83
149
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
+
84
157
[[deprecations-and-pruning]]
85
158
== Deprecations and pruning
86
159
87
160
As with any major release, some features have been deprecated or removed in Spring Batch 6.0. The following changes are worth noting:
88
161
89
162
* 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
91
164
* Several APIs have been deprecated in this version, in order to simplify the core API and reduce its scope
92
165
93
166
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