Add task executor to partition step
This commit is contained in:
parent
44aa688a20
commit
864c9c2cb8
|
@ -14,7 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.task.TaskExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spring batch Job configuration file. Contains all necessary plumbing to run a
|
||||||
|
* Bulk Export job.
|
||||||
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class BulkExportJobConfig {
|
public class BulkExportJobConfig {
|
||||||
|
|
||||||
|
@ -27,6 +32,9 @@ public class BulkExportJobConfig {
|
||||||
@Autowired
|
@Autowired
|
||||||
private PidToIBaseResourceProcessor myPidToIBaseResourceProcessor;
|
private PidToIBaseResourceProcessor myPidToIBaseResourceProcessor;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TaskExecutor myTaskExecutor;
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Job bulkExportJob() {
|
public Job bulkExportJob() {
|
||||||
return myJobBuilderFactory.get("bulkExportJob")
|
return myJobBuilderFactory.get("bulkExportJob")
|
||||||
|
@ -39,6 +47,7 @@ public class BulkExportJobConfig {
|
||||||
public Step bulkExportGenerateResourceFilesStep() {
|
public Step bulkExportGenerateResourceFilesStep() {
|
||||||
return myStepBuilderFactory.get("bulkExportGenerateResourceFilesStep")
|
return myStepBuilderFactory.get("bulkExportGenerateResourceFilesStep")
|
||||||
.<ResourcePersistentId, IBaseResource> chunk(1000) //1000 resources per generated file
|
.<ResourcePersistentId, IBaseResource> chunk(1000) //1000 resources per generated file
|
||||||
|
//TODO should we potentially make this configurable?
|
||||||
.reader(bulkItemReader(null))
|
.reader(bulkItemReader(null))
|
||||||
.processor(myPidToIBaseResourceProcessor)
|
.processor(myPidToIBaseResourceProcessor)
|
||||||
.writer(resourceToFileWriter())
|
.writer(resourceToFileWriter())
|
||||||
|
@ -56,6 +65,7 @@ public class BulkExportJobConfig {
|
||||||
return myStepBuilderFactory.get("partitionStep")
|
return myStepBuilderFactory.get("partitionStep")
|
||||||
.partitioner("bulkExportGenerateResourceFilesStep", partitioner(null))
|
.partitioner("bulkExportGenerateResourceFilesStep", partitioner(null))
|
||||||
.step(bulkExportGenerateResourceFilesStep())
|
.step(bulkExportGenerateResourceFilesStep())
|
||||||
|
.taskExecutor(myTaskExecutor)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue