//package com.smartor.config;
|
//
|
//import org.springframework.amqp.core.*;
|
//import org.springframework.beans.factory.annotation.Qualifier;
|
//import org.springframework.context.annotation.Bean;
|
//import org.springframework.context.annotation.Configuration;
|
//
|
//import java.util.HashMap;
|
//import java.util.Map;
|
//
|
////@Configuration
|
//public class RabbitMqConfig {
|
//
|
////定义延迟队列
|
// public static final String phone_queue = "phone_queue";
|
// //定义延迟交换机
|
// public static final String phone_exchange = "phone_exchange";
|
// //定义路由键
|
// public static final String routing_key = "phone.123";
|
//
|
//
|
// /**
|
// * 定义延迟队列
|
// *
|
// * @return
|
// */
|
// @Bean
|
// public Queue delayQueue() {
|
// return new Queue(phone_queue, true);
|
// }
|
//
|
// /**
|
// * 延时队列交换机
|
// * 交换机类型:CustomExchange
|
// *
|
// * @return
|
// */
|
// @Bean
|
// public CustomExchange delayExchange() {
|
// Map<String, Object> args = new HashMap<>();
|
// args.put("x-delayed-type", "topic");
|
// return new CustomExchange(phone_exchange, "x-delayed-message", true, false, args);
|
// }
|
//
|
// /**
|
// * 为延迟队列绑定交换机
|
// *
|
// * @param queue
|
// * @param exchange
|
// * @return
|
// */
|
// @Bean
|
// public Binding delayBinding(Queue queue, CustomExchange exchange) {
|
// return BindingBuilder.bind(queue).to(exchange).with(routing_key).noargs();
|
// }
|
//
|
//}
|