package com.tourism.webadmin.ws.mq;

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

@Configuration
public class RabbitMQConfig {

    @Bean("systemQueue")
    public Queue systemQueue() {
        return new Queue("systemQueue",true);
    }
    @Bean("focusQueue")
    public Queue focusQueue() {
        return new Queue("focusQueue",true);
    }
    @Bean("interactQueue")
    public Queue interactQueue() {
        return new Queue("interactQueue",true);
    }


    @Bean("systemExchange")
    public Exchange systemExchange() {
        return new DirectExchange("systemExchange",true,false);
    }
    @Bean("focusExchange")
    public Exchange focusExchange() {
        return new DirectExchange("focusExchange",true,false);
    }
    @Bean("interactExchange")
    public Exchange interactExchange() {
        return new DirectExchange("interactExchange",true,false);
    }
    @Bean("systemBinding")
    public Binding systemBinding() {
        return BindingBuilder.bind(systemQueue()).to(systemExchange()).with("systemRouter").noargs();
    }
    @Bean("interactBinding")
    public Binding interactBinding() {
        return BindingBuilder.bind(interactQueue()).to(interactExchange()).with("interactRouter").noargs();
    }
    @Bean("focusBinding")
    public Binding focusBinding() {
        return BindingBuilder.bind(focusQueue()).to(focusExchange()).with("focusRouter").noargs();
    }



}
