Subversion Repositories SmartDukaan

Rev

Rev 35547 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
35547 amit 1
package com.spice.profitmandi.dao.config;
2
 
3
import org.springframework.context.annotation.Bean;
4
import org.springframework.context.annotation.Configuration;
5
import org.springframework.scheduling.annotation.EnableAsync;
6
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
7
 
8
import java.util.concurrent.Executor;
9
 
10
/**
11
 * Configuration for async processing of Solr updates.
12
 * Enables non-blocking Solr updates when TagListing changes.
13
 */
14
@Configuration
15
@EnableAsync
16
public class AsyncConfig {
17
 
18
    @Bean(name = "solrUpdateExecutor")
19
    public Executor solrUpdateExecutor() {
20
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
21
        executor.setCorePoolSize(2);
22
        executor.setMaxPoolSize(5);
23
        executor.setQueueCapacity(100);
24
        executor.setThreadNamePrefix("solr-update-");
25
        executor.initialize();
26
        return executor;
27
    }
35956 amit 28
 
29
    @Bean(name = "mailOutboxExecutor")
30
    public Executor mailOutboxExecutor() {
31
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
32
        executor.setCorePoolSize(2);
33
        executor.setMaxPoolSize(5);
34
        executor.setQueueCapacity(200);
35
        executor.setThreadNamePrefix("mail-outbox-");
36
        executor.initialize();
37
        return executor;
38
    }
35547 amit 39
}