From ffd586b4b93665e1bf90df114e5eda71b47f20a8 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Tue, 08 Jun 2021 16:24:37 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java | 69 ++++++++++++++++++++++++++++++++++
1 files changed, 69 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 e19007f..084d625 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
@@ -122,6 +124,20 @@
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";
+
+ public static final String QUEUE_MSG_HISTORY = "queue_msg_history";
+ public static final String ROUTING_KEY_MSG_HISTORY = "routing_key_msg_history";
+
+ public static final String QUEUE_TRC20_BLOCK = "QUEUE_TRC20_BLOCK";
+ public static final String ROUTING_TRC20_BLOCK = "ROUTING_TRC20_BLOCK";
+
+
+ public static final String QUEUE_ORDER_RETURN = "QUEUE_ORDER_RETURN";
+ public static final String ROUTING_ORDER_RETURN = "ROUTING_ORDER_RETURN";
+
@Resource
private ConnectionFactory connectionFactory;
@@ -146,6 +162,27 @@
}
@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);
}
@@ -156,6 +193,38 @@
}
@Bean
+ public Queue msgHistoryQueue() {
+ return new Queue(QUEUE_MSG_HISTORY);
+ }
+
+ @Bean
+ public Binding msgHistoryBinding() {
+ return BindingBuilder.bind(msgHistoryQueue()).to(defaultExchange()).with(ROUTING_KEY_MSG_HISTORY);
+ }
+
+ @Bean
+ public Queue orderReturnQueue() {
+ return new Queue(QUEUE_ORDER_RETURN);
+ }
+
+ @Bean
+ public Binding orderReturnBinding() {
+ return BindingBuilder.bind(orderReturnQueue()).to(defaultExchange()).with(ROUTING_ORDER_RETURN);
+ }
+
+
+ @Bean
+ public Queue trc20Queue() {
+ return new Queue(QUEUE_TRC20_BLOCK);
+ }
+
+ @Bean
+ public Binding trc20Binding() {
+ return BindingBuilder.bind(trc20Queue()).to(defaultExchange()).with(ROUTING_TRC20_BLOCK);
+ }
+
+
+ @Bean
public Queue testQueue() {
return new Queue(QUEUE_TEST, true);
}
--
Gitblit v1.9.1