Class MultiResourcePartitioner
java.lang.Object
org.springframework.batch.core.partition.support.MultiResourcePartitioner
- All Implemented Interfaces:
Partitioner
Implementation of
Partitioner
that locates multiple resources and associates
their file names with execution context keys. Creates an ExecutionContext
per
resource, and labels them as {partition0, partition1, ..., partitionN}
.
The grid size is ignored.- Since:
- 2.0
- Author:
- Dave Syer
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionpartition
(int gridSize) Assign the filename of each of the injected resources to anExecutionContext
.void
setKeyName
(String keyName) The name of the key for the file name in eachExecutionContext
.void
setResources
(org.springframework.core.io.Resource[] resources) The resources to assign to each partition.
-
Constructor Details
-
MultiResourcePartitioner
public MultiResourcePartitioner()
-
-
Method Details
-
setResources
public void setResources(org.springframework.core.io.Resource[] resources) The resources to assign to each partition. In Spring configuration you can use a pattern to select multiple resources.- Parameters:
resources
- the resources to use
-
setKeyName
The name of the key for the file name in eachExecutionContext
. Defaults to "fileName".- Parameters:
keyName
- the value of the key
-
partition
Assign the filename of each of the injected resources to anExecutionContext
.- Specified by:
partition
in interfacePartitioner
- Parameters:
gridSize
- the size of the map to return- Returns:
- a map from identifier to input parameters
- See Also:
-