13693261870
2022-09-20 a666b5f9741ef9b21f547d3b2141752a0383c70c
src/java/org/apereo/cas/web/landtool/rabbitmq/config/RabbitConfig.java
@@ -1,12 +1,6 @@
package org.apereo.cas.web.landtool.rabbitmq.config;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -18,45 +12,14 @@
@Configuration
public class RabbitConfig {
   @Autowired
   private RabbitMQProperties rabbitConfig;
//   @Bean
//    public ConnectionFactory connectionFactory() {
//        CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
//        connectionFactory.setAddresses("192.168.0.19:5672");
//        connectionFactory.setUsername("landtool");
//        connectionFactory.setPassword("lt");
//        connectionFactory.setVirtualHost("/radar");
//        connectionFactory.setPublisherConfirms(true);
//        return connectionFactory;
//    }
//
//   @Bean
//    public RabbitTemplate rabbitTemplate() {
//        RabbitTemplate template = new RabbitTemplate(connectionFactory());
//        return template;
//    }
//   //声明队列
//   @Bean
//    public Queue queueMessage() {
//        return new Queue("topic.message");
//    }
   //声明交互器
   private RabbitMqProperties rabbitConfig;
    /**
     * 声明交互器
     * @return
     */
    @Bean
    TopicExchange topicExchange() {
        return new TopicExchange(rabbitConfig.getRmqExchangeName(),false,false);
    }
//    /**
//     * 将队列topic.message与exchange绑定,binding_key为topic.message,就是完全匹配
//     * @param queueMessage
//     * @param exchange
//     * @return
//     */
//    @Bean
//    Binding bindingExchangeMessage(Queue queueMessage, TopicExchange exchange) {
//        return BindingBuilder.bind(queueMessage).to(exchange).with("topic.#");
//    }
}