@@ -52,11 +52,10 @@ This reader stores message offsets in the execution context to support restart c
|
||||
rows, such that large datasets can be read without running out of
|
||||
memory.|Yes
|
||||
|`ListItemReader`|Provides the items from a list, one at a time.|No
|
||||
|`MongoItemReader`|Given a `MongoOperations` object and a JSON-based MongoDB
|
||||
|`MongoPagingItemReader`|Given a `MongoOperations` object and a JSON-based MongoDB
|
||||
query, provides items received from the `MongoOperations#find()` method.|Yes
|
||||
|`Neo4jItemReader`|Given a `Neo4jOperations` object and the components of a
|
||||
Cyhper query, items are returned as the result of the Neo4jOperations.query
|
||||
method.|Yes
|
||||
|`MongoCursorItemReader`|Given a `MongoOperations` object and a JSON-based MongoDB
|
||||
query, provides items received from the `MongoOperations#stream()` method.|Yes
|
||||
|`RepositoryItemReader`|Given a Spring Data `PagingAndSortingRepository` object,
|
||||
a `Sort`, and the name of method to execute, returns items provided by the
|
||||
Spring Data repository implementation.|Yes
|
||||
@@ -106,9 +105,6 @@ This reader stores message offsets in the execution context to support restart c
|
||||
|`MongoItemWriter`|Given a `MongoOperations` object, items are written
|
||||
through the `MongoOperations.save(Object)` method. The actual write is delayed
|
||||
until the last possible moment before the transaction commits.|Yes
|
||||
|`Neo4jItemWriter`|Given a `Neo4jOperations` object, items are persisted through the
|
||||
`save(Object)` method or deleted through the `delete(Object)`, as dictated by the
|
||||
`ItemWriter's` configuration|Yes
|
||||
|`PropertyExtractingDelegatingItemWriter`|Extends `AbstractMethodInvokingDelegator`
|
||||
creating arguments on the fly. Arguments are created by retrieving
|
||||
the values from the fields in the item to be processed (through a
|
||||
|
||||
@@ -177,58 +177,6 @@ You can populate a `JobRegistry` in one of the following ways: by using
|
||||
a bean post processor, or by using a smart initializing singleton or by using
|
||||
a registrar lifecycle component. The coming sections describe these mechanisms.
|
||||
|
||||
[[jobregistrybeanpostprocessor]]
|
||||
=== JobRegistryBeanPostProcessor
|
||||
|
||||
This is a bean post-processor that can register all jobs as they are created.
|
||||
|
||||
[tabs]
|
||||
====
|
||||
Java::
|
||||
+
|
||||
The following example shows how to include the `JobRegistryBeanPostProcessor` for a job
|
||||
defined in Java:
|
||||
+
|
||||
.Java Configuration
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry) {
|
||||
JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
|
||||
postProcessor.setJobRegistry(jobRegistry);
|
||||
return postProcessor;
|
||||
}
|
||||
----
|
||||
|
||||
XML::
|
||||
+
|
||||
The following example shows how to include the `JobRegistryBeanPostProcessor` for a job
|
||||
defined in XML:
|
||||
+
|
||||
.XML Configuration
|
||||
[source, xml]
|
||||
----
|
||||
<bean id="jobRegistryBeanPostProcessor" class="org.spr...JobRegistryBeanPostProcessor">
|
||||
<property name="jobRegistry" ref="jobRegistry"/>
|
||||
</bean>
|
||||
----
|
||||
|
||||
====
|
||||
|
||||
|
||||
|
||||
Although it is not strictly necessary, the post-processor in the
|
||||
example has been given an `id` so that it can be included in child
|
||||
contexts (for example, as a parent bean definition) and cause all jobs created
|
||||
there to also be registered automatically.
|
||||
|
||||
[WARNING]
|
||||
.Deprecation
|
||||
====
|
||||
As of version 5.2, the `JobRegistryBeanPostProcessor` class is deprecated in favor of
|
||||
`JobRegistrySmartInitializingSingleton`, see xref:#jobregistrysmartinitializingsingleton[JobRegistrySmartInitializingSingleton].
|
||||
====
|
||||
|
||||
[[jobregistrysmartinitializingsingleton]]
|
||||
=== JobRegistrySmartInitializingSingleton
|
||||
|
||||
@@ -343,7 +291,7 @@ configuration in the child, provided it should be the same as the
|
||||
parent.
|
||||
|
||||
You can use `AutomaticJobRegistrar` in
|
||||
conjunction with a `JobRegistryBeanPostProcessor`
|
||||
conjunction with a `JobRegistrySmartInitializingSingleton`
|
||||
(as long as you also use `DefaultJobLoader`).
|
||||
For instance, this might be desirable if there are jobs
|
||||
defined in the main parent context as well as in the child
|
||||
|
||||
@@ -161,21 +161,21 @@ construct an instance of the `KafkaItemWriter`.
|
||||
== Database Readers
|
||||
Spring Batch offers the following database readers:
|
||||
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#Neo4jItemReader[`Neo4jItemReader`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#mongoItemReader[`MongoItemReader`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#mongoPagingItemReader[`MongoPagingItemReader`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#mongoCursorItemReader[`MongoCursorItemReader`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#repositoryItemReader[`RepositoryItemReader`]
|
||||
|
||||
[[Neo4jItemReader]]
|
||||
=== `Neo4jItemReader`
|
||||
The `Neo4jItemReader` is an `ItemReader` that reads objects from the graph database Neo4j
|
||||
by using a paging technique. Spring Batch provides a `Neo4jItemReaderBuilder` to
|
||||
construct an instance of the `Neo4jItemReader`.
|
||||
[[mongoPagingItemReader]]
|
||||
=== `MongoPagingItemReader`
|
||||
The `MongoPagingItemReader` is an `ItemReader` that reads documents from MongoDB by using a
|
||||
paging technique. Spring Batch provides a `MongoPagingItemReaderBuilder` to construct an
|
||||
instance of the `MongoPagingItemReader`.
|
||||
|
||||
[[mongoItemReader]]
|
||||
=== `MongoItemReader`
|
||||
The `MongoItemReader` is an `ItemReader` that reads documents from MongoDB by using a
|
||||
paging technique. Spring Batch provides a `MongoItemReaderBuilder` to construct an
|
||||
instance of the `MongoItemReader`.
|
||||
[[mongoCursorItemReader]]
|
||||
=== `MongoCursorItemReader`
|
||||
The `MongoCursorItemReader` is an `ItemReader` that reads documents from MongoDB by using a
|
||||
streaming technique. Spring Batch provides a `MongoCursorItemReaderBuilder` to construct an
|
||||
instance of the `MongoCursorItemReader`.
|
||||
|
||||
[[repositoryItemReader]]
|
||||
=== `RepositoryItemReader`
|
||||
@@ -187,18 +187,11 @@ construct an instance of the `RepositoryItemReader`.
|
||||
== Database Writers
|
||||
Spring Batch offers the following database writers:
|
||||
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#neo4jItemWriter[`Neo4jItemWriter`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#mongoItemWriter[`MongoItemWriter`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#repositoryItemWriter[`RepositoryItemWriter`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#jdbcBatchItemWriter[`JdbcBatchItemWriter`]
|
||||
* xref:readers-and-writers/item-reader-writer-implementations.adoc#jpaItemWriter[`JpaItemWriter`]
|
||||
|
||||
[[neo4jItemWriter]]
|
||||
=== `Neo4jItemWriter`
|
||||
The `Neo4jItemWriter` is an `ItemWriter` implementation that writes to a Neo4j database.
|
||||
Spring Batch provides a `Neo4jItemWriterBuilder` to construct an instance of the
|
||||
`Neo4jItemWriter`.
|
||||
|
||||
[[mongoItemWriter]]
|
||||
=== `MongoItemWriter`
|
||||
The `MongoItemWriter` is an `ItemWriter` implementation that writes to a MongoDB store
|
||||
|
||||
@@ -133,29 +133,6 @@ Note also that there may be limits placed on concurrency by any pooled resources
|
||||
your step, such as a `DataSource`. Be sure to make the pool in those resources at least
|
||||
as large as the desired number of concurrent threads in the step.
|
||||
|
||||
[WARNING]
|
||||
.Throttle limit deprecation
|
||||
====
|
||||
As of v5.0, the throttle limit is deprecated with no replacement. If you want to replace the
|
||||
current throttling mechanism in the default `TaskExecutorRepeatTemplate`, you need to provide
|
||||
a custom `RepeatOperations` implementation (based on a `TaskExecutor` with a bounded task queue)
|
||||
and set it on the step with `StepBuilder#stepOperations`:
|
||||
|
||||
.Java Configuration
|
||||
[source, java]
|
||||
----
|
||||
@Bean
|
||||
public Step sampleStep(RepeatOperations customRepeatOperations, JobRepository jobRepository, PlatformTransactionManager transactionManager) {
|
||||
return new StepBuilder("sampleStep", jobRepository)
|
||||
.<String, String>chunk(10, transactionManager)
|
||||
.reader(itemReader())
|
||||
.writer(itemWriter())
|
||||
.stepOperations(customRepeatOperations)
|
||||
.build();
|
||||
}
|
||||
----
|
||||
====
|
||||
|
||||
There are some practical limitations of using multi-threaded `Step` implementations for
|
||||
some common batch use cases. Many participants in a `Step` (such as readers and writers)
|
||||
are stateful. If the state is not segregated by thread, those components are not
|
||||
|
||||
Reference in New Issue
Block a user