forked from vimal-java-dev/vimaltech-contact-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncConfig.java
More file actions
22 lines (18 loc) · 763 Bytes
/
AsyncConfig.java
File metadata and controls
22 lines (18 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.vimaltech.contactapi.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
@Configuration
public class AsyncConfig {
@Bean(name = "emailExecutor")
public Executor emailExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(3); // baseline threads (good for VPS)
executor.setMaxPoolSize(8); // peak load
executor.setQueueCapacity(100); // queue size
executor.setThreadNamePrefix("EmailThread-");
executor.initialize();
return executor;
}
}