package com.lovecoding.rabbitmq.consumer;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {

    @Bean
    public DirectExchange directExchange(){
        return new DirectExchange("com.lc.direct.demo");
    }

    @Bean
    public Queue directQueue(){
        return new Queue("directQueue");
    }

    @Bean
    public Queue directQueueT6(){
        return new Queue("directQueueT6");
    }

    @Bean
    public Binding getBindingDirectQueue( Queue directQueue, DirectExchange directExchange ){
        return BindingBuilder.bind(directQueue).to(directExchange).with( "北京" );
    }

    @Bean
    public Binding getBindingDirectQueueT6(Queue directQueueT6, DirectExchange directExchange){
        return BindingBuilder.bind(directQueueT6).to(directExchange).with("哈尔滨");
    }
}
