From f243bb8af00a2464d16536d42150a4107f87b4ae Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期日, 12 五月 2024 21:32:57 +0800
Subject: [PATCH] 代码提交

---
 smartor/src/main/java/com/smartor/config/RabbitMqConfig.java |  134 ++++++++++++++++----------------------------
 1 files changed, 50 insertions(+), 84 deletions(-)

diff --git a/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java b/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java
index aab306a..e621e62 100644
--- a/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java
+++ b/smartor/src/main/java/com/smartor/config/RabbitMqConfig.java
@@ -1,91 +1,57 @@
-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 EXCHANGE_NAME = "phone_topic_exchange2";
-//    public static final String QUEUE_NAME = "phone_queue";
-    //
-//    /**
-//     * topic浜ゆ崲鏈�,骞舵寔涔呭寲
-//     */
-//    @Bean(EXCHANGE_NAME)
-//    public Exchange phoneExchange() {
-//        Map<String, Object> arguments = new HashMap<>();
-//        //鎸囧畾閫氫俊鏂瑰紡涓簍opic
-//        arguments.put("x-delayed-type", "topic");
-//        //浣跨敤CustomExchange绫诲垱寤猴紝绫诲瀷瑕佹寚瀹氫负鈥渪-delayed-message鈥濈被鍨�
-//        Exchange exchange = new CustomExchange(EXCHANGE_NAME, "x-delayed-message", true, false, arguments);
-//        return exchange;
+//package com.smartor.config;
 //
-////
-////        return ExchangeBuilder.topicExchange(EXCHANGE_NAME).durable(true).build();
-//    }
+//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";
 //
 //
 //    /**
-//     * 闃熷垪
-//     */
-//    @Bean(QUEUE_NAME)
-//    public Queue phoneQueue() {
-//        return QueueBuilder.durable(QUEUE_NAME).build();
-//    }
-//
-//    /**
-//     * 浜ゆ崲鏈轰笌闃熷垪鐨勭粦瀹�
+//     * 瀹氫箟寤惰繜闃熷垪
+//     *
+//     * @return
 //     */
 //    @Bean
-//    public Binding bindQueueExchange(@Qualifier(QUEUE_NAME) Queue phoneQueue, @Qualifier(EXCHANGE_NAME) Exchange phoneExchange) {
-//        return BindingBuilder.bind(phoneQueue).to(phoneExchange).with(" phone.#").noargs();
+//    public Queue delayQueue() {
+//        return new Queue(phone_queue, true);
 //    }
-//瀹氫箟寤惰繜闃熷垪
-    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();
-    }
-
-}
+//
+//    /**
+//     * 寤舵椂闃熷垪浜ゆ崲鏈�
+//     * 浜ゆ崲鏈虹被鍨嬶細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();
+//    }
+//
+//}

--
Gitblit v1.9.3