package net.northking.cctp.device.bus.publisher.fanout;

import net.northking.cctp.device.bus.BusConstants;
import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DeviceFanoutPublisher {
    //设备信息的队列 fanout

    @Bean
    public DirectExchange fanoutExchange(){
        return new DirectExchange(BusConstants.Device_Exchange_Name,true,false);
    }

    @Bean
    public Queue deviceStatusQueue(){
        return new Queue("device.status.queue");
    }

    @Bean
    public Binding deviceStatusBinging(){
        return BindingBuilder.bind(deviceStatusQueue()).to(fanoutExchange()).with("status");
    }

}
