package com.lovecoding.rabbitmq.consumer;

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

@Configuration
public class FanoutConfig {

    @Bean
    public FanoutExchange fanoutExchangeDemo(){
        return new FanoutExchange("com.lc.fanout.demo");
    }

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

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

    @Bean
    public Binding getBindingFanout( FanoutExchange fanoutExchangeDemo, Queue queueDemo ){
        return BindingBuilder.bind(queueDemo).to(fanoutExchangeDemo);
    }

    @Bean
    public Binding getBindingFanoutT4( FanoutExchange fanoutExchangeDemo, Queue queueDemoT4 ){
        return BindingBuilder.bind(queueDemoT4).to(fanoutExchangeDemo);
    }
}
