Fix batch project to now use an async task launcher
This commit is contained in:
parent
b31b6652a9
commit
8f6aee64b1
|
@ -5,6 +5,8 @@ import org.springframework.batch.core.configuration.annotation.EnableBatchProces
|
|||
import org.springframework.batch.support.transaction.ResourcelessTransactionManager;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.task.TaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
|
||||
@Configuration
|
||||
|
@ -15,6 +17,17 @@ public class TestBatchConfig {
|
|||
public PlatformTransactionManager hapiTransactionManager() {
|
||||
return new ResourcelessTransactionManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TaskExecutor jobLaunchingTaskExecutor() {
|
||||
ThreadPoolTaskExecutor asyncTaskExecutor = new ThreadPoolTaskExecutor();
|
||||
asyncTaskExecutor.setCorePoolSize(5);
|
||||
asyncTaskExecutor.setMaxPoolSize(10);
|
||||
asyncTaskExecutor.setQueueCapacity(500);
|
||||
asyncTaskExecutor.setThreadNamePrefix("JobLauncher-");
|
||||
asyncTaskExecutor.initialize();
|
||||
return asyncTaskExecutor;
|
||||
}
|
||||
@Bean
|
||||
public BatchConfigurer batchConfigurer() {
|
||||
return new NonPersistedBatchConfigurer();
|
||||
|
|
|
@ -1,18 +1,14 @@
|
|||
package ca.uhn.fhir.jpa.batch.svc;
|
||||
|
||||
import ca.uhn.fhir.jpa.batch.BaseBatchR4Test;
|
||||
import ca.uhn.fhir.jpa.batch.config.BatchJobConfig;
|
||||
import org.junit.Test;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersInvalidException;
|
||||
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
|
||||
import org.springframework.batch.core.repository.JobInstanceAlreadyCompleteException;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
public class BatchSvcTest extends BaseBatchR4Test {
|
||||
@Autowired
|
||||
private BatchJobConfig myBatchJobConfig;
|
||||
|
||||
@Test
|
||||
public void testApplicationContextLoads() throws JobParametersInvalidException, JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException, InterruptedException {
|
||||
|
|
Loading…
Reference in New Issue