package com.backendsys.modules.sdk.comfyui.rabbitmq;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;

/**
 * 死信队列
 * 在项目启动时创建 (RabbitMQ) 队列、交换机、绑定关系
 */
@Configuration
@Lazy(false)
public class ComfyuiQueueDlxConfig {

    /* === 死信交换机/队列 === */
    public static final String EXCHANGE = "comfyui.dlx.exchange";
    public static final String QUEUE = "comfyui.dlx.queue";
    public static final String ROUTING_KEY = "comfyui.dlx.routekey";

    @Bean
    public DirectExchange comfyuiDlxExchange() { return ExchangeBuilder.directExchange(EXCHANGE).durable(true).build(); }

    @Bean
    public Queue comfyuiDlxQueue() { return QueueBuilder.durable(QUEUE).build(); }

    @Bean
    public Binding comfyuiDlxBinding() { return BindingBuilder.bind(comfyuiDlxQueue()).to(comfyuiDlxExchange()).with(ROUTING_KEY); }

}
