From 0ca7bf5c850eaef852a6b49d4b94e8366deedb29 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Wed, 26 May 2021 15:03:51 +0800
Subject: [PATCH] 20210525  申诉

---
 src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java |   41 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 41 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
index 216bcca..0511ab1 100644
--- a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
+++ b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
@@ -13,6 +13,8 @@
 import org.springframework.context.annotation.Scope;
 
 import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @author wzy
@@ -118,6 +120,14 @@
     // 全仓价格操作
     public static final String ROUTINGKEY_WHOLE_PRICE = "ROUTINGKEY_WHOLE_PRICE";
 
+    public static final String ROUTINGKEY_MARKET_BUSSINESS = "ROUTINGKEY_MARKET_BUSSINESS";
+
+    public static final String QUEUE_MARKET_BUSSINESS = "QUEUE_MARKET_BUSSINESS";
+
+    public static final String ROUTING_KEY_DELAY = "route.delay";
+    public static final String QUEUE_DELAY = "queue.delay";
+    public static final String EXCHANGE_DELAY = "exchange.delay";
+
     @Resource
     private ConnectionFactory connectionFactory;
 
@@ -142,6 +152,37 @@
     }
 
     @Bean
+    public DirectExchange delayExchange() {
+        return new DirectExchange(EXCHANGE_DELAY);
+    }
+
+    @Bean
+    public Queue delayQueue() {
+        Map<String, Object> params = new HashMap<>();
+        // x-dead-letter-exchange 声明了队列里的死信转发到的DLX名称,
+        params.put("x-dead-letter-exchange", EXCHANGE_DELAY);
+        // x-dead-letter-routing-key 声明了这些死信在转发时携带的 routing-key 名称。
+        params.put("x-dead-letter-routing-key", ROUTING_KEY_DELAY);
+//        params.put("x-message-ttl", 6000);
+        return new Queue(QUEUE_DELAY, true, false, false, params);
+    }
+
+    @Bean
+    public Binding delayBinding() {
+        return BindingBuilder.bind(delayQueue()).to(delayExchange()).with(ROUTING_KEY_DELAY);
+    }
+
+    @Bean
+    public Queue marketBussinessQueue() {
+        return new Queue(QUEUE_MARKET_BUSSINESS);
+    }
+
+    @Bean
+    public Binding marketBussinessBinding() {
+        return BindingBuilder.bind(marketBussinessQueue()).to(defaultExchange()).with(ROUTINGKEY_MARKET_BUSSINESS);
+    }
+
+    @Bean
     public Queue testQueue() {
         return new Queue(QUEUE_TEST, true);
     }

--
Gitblit v1.9.1