From 864c9c2cb81ec736aa334f353bcca519c7dc81e4 Mon Sep 17 00:00:00 2001 From: Tadgh Date: Mon, 8 Jun 2020 16:35:15 -0700 Subject: [PATCH] Add task executor to partition step --- .../ca/uhn/fhir/jpa/bulk/job/BulkExportJobConfig.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobConfig.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobConfig.java index af5bd822e3c..9cbd5f95f53 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobConfig.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/bulk/job/BulkExportJobConfig.java @@ -14,7 +14,12 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; 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 public class BulkExportJobConfig { @@ -27,6 +32,9 @@ public class BulkExportJobConfig { @Autowired private PidToIBaseResourceProcessor myPidToIBaseResourceProcessor; + @Autowired + private TaskExecutor myTaskExecutor; + @Bean public Job bulkExportJob() { return myJobBuilderFactory.get("bulkExportJob") @@ -39,6 +47,7 @@ public class BulkExportJobConfig { public Step bulkExportGenerateResourceFilesStep() { return myStepBuilderFactory.get("bulkExportGenerateResourceFilesStep") . chunk(1000) //1000 resources per generated file + //TODO should we potentially make this configurable? .reader(bulkItemReader(null)) .processor(myPidToIBaseResourceProcessor) .writer(resourceToFileWriter()) @@ -56,6 +65,7 @@ public class BulkExportJobConfig { return myStepBuilderFactory.get("partitionStep") .partitioner("bulkExportGenerateResourceFilesStep", partitioner(null)) .step(bulkExportGenerateResourceFilesStep()) + .taskExecutor(myTaskExecutor) .build(); }