package com.shzg.project.worn.unit;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

@Configuration
public class MqttThreadPoolConfig {

    @Bean("mqttExecutor")
    public Executor mqttExecutor() {
        return new ThreadPoolExecutor(
                10,                  // 核心线程
                50,                  // 最大线程
                60,
                TimeUnit.SECONDS,
                new LinkedBlockingQueue<>(1000),
                new ThreadPoolExecutor.CallerRunsPolicy()
        );
    }
}