//package com.backendsys.modules.common.config.rabbitmq;
//
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
//import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistry;
//import org.springframework.boot.CommandLineRunner;
//import org.springframework.stereotype.Component;
//
///**
// * 手动启动监听器
// * 由于 RabbitMQ 的监听器默认是懒加载，所以需要手动启动监听器
// */
//@Slf4j
//@Component
//@RequiredArgsConstructor
//public class DemoRabbitListenerRunner implements CommandLineRunner {
//
//    private final RabbitListenerEndpointRegistry registry;
//
////    @Override
////    public void run(String... args) {
////        List<String> MANUAL_START_IDS = List.of("demoContainer", "demoDlxContainer");
////        MANUAL_START_IDS.forEach(id -> {
////            MessageListenerContainer c = registry.getListenerContainer(id);
////            if (c != null && !c.isRunning()) {
////                c.start();
////                System.out.printf("-- ComfyuiRabbitListener '{}' 已手动启动 --", id);
////            }
////        });
////    }
//
//    public void run(String... args) {
//        MessageListenerContainer container = registry.getListenerContainer("demoDlxContainer");
//
//        System.out.println("-- DemoRabbitListenerRunner container = " + container);
//        System.out.println("container.isRunning() = " + container.isRunning());
//
//        if (container != null && !container.isRunning()) {
//            container.start();     // 关键：真正启动监听
//            System.out.println("-- demoDlxContainer Listener 已手动启动 --");
//        }
//    }
//
//}
