package com.unis.crk.rabbitmq;

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


/**
 * Direct交换机配置
 */
//@Configuration
public class RabbitConfig {

    private static final String ROUTE_KEY= "lcapPatrol.*";
    public static final String QUEUE_NAME = "inOutLib.ddm51";
    private static final String EXCHANGE_NAME = "datacenter.exchange";

    private static final String CRK_ROUTE_KEY= "inOutLib.*";
    public static final String CRK_QUEUE_NAME = "inOutLib.sendData51";
    public static final String CRK_EXCHANGE_NAME = "inOutLib.exchange";

    private static final String DS_ROUTE_KEY= "electronicCommerce.*";
    public static final String DS_QUEUE_NAME = "electronicCommerce.DsSendData";
    public static final String DS_EXCHANGE_NAME = "electronicCommerce.exchange";

  /*  *//**
     * 交换机
     *//*
    @Bean
    public TopicExchange myDirectExchange() {
        // 参数意义:
        // name: 名称
        // durable: true
        // autoDelete: 自动删除
        return new TopicExchange(EXCHANGE_NAME, true, false);
    }
    @Bean
    public TopicExchange crkDirectExchange() {
        // 参数意义:
        // name: 名称
        // durable: true
        // autoDelete: 自动删除
        return new TopicExchange(CRK_EXCHANGE_NAME, true, false);
    }
    @Bean
    public TopicExchange dsDirectExchange() {
        // 参数意义:
        // name: 名称
        // durable: true
        // autoDelete: 自动删除
        return new TopicExchange(DS_EXCHANGE_NAME, true, false);
    }

    *//**
     * 消息队列
     *//*
    @Bean
    public Queue directQueue() {
        return new Queue(QUEUE_NAME, true);
    }

    @Bean
    public Binding queue1BindingDirect() {
        return BindingBuilder.bind(directQueue())
                .to(myDirectExchange())
                .with(ROUTE_KEY);
    }
    @Bean
    public Queue crkDirectQueue() {
        return new Queue(CRK_QUEUE_NAME, true);
    }
    @Bean
    public Binding crkQueue1BindingDirect() {
        return BindingBuilder.bind(crkDirectQueue())
                .to(crkDirectExchange())
                .with(CRK_ROUTE_KEY);
    }


    @Bean
    public Queue dsDirectQueue() {
        return new Queue(DS_QUEUE_NAME, true);
    }
    @Bean
    public Binding dsQueue1BindingDirect() {
        return BindingBuilder.bind(dsDirectQueue())
                .to(dsDirectExchange())
                .with(DS_ROUTE_KEY);
    }*/
}

