From f6a912c1a6a26c809568f964941fb4ad4483274e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 31 May 2021 11:19:40 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java | 222 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 218 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java
index 7be7f09..d43efca 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
@@ -21,13 +23,32 @@
@Configuration
public class RabbitMqConfig {
- public static final String EXCHANGE_ONE = "excoin-exchange-one";
+ public static final String EXCHANGE_ONE = "biue-exchange-one";
public static final String QUEUE_TEST = "test-queue";
public static final String ROUTING_KEY_TEST = "test-routingKey";
- public static final String EXCHANGE_A = "biyi-exchange-A";
+ public static final String EXCHANGE_A = "biue-exchange-A";
+
+
+ public static final String EXCHANGE_USDT_UPDATE = "exchange_usdt_update";
+
+ public static final String QUEUE_USDT_UPDATE = "queue_usdt_update";
+
+ public static final String ROUTING_KEY_USDT_UPDATE = "routing_key_usdt_update";
+
+ public static final String EXCHANGE_USDT_ADDRESS = "exchange_usdt_address";
+
+ public static final String QUEUE_USDT_ADDRESS= "queue_usdt_address";
+
+ public static final String ROUTING_KEY_USDT_ADDRESS = "routing_key_usdt_address";
+
+
+ /**
+ * 撮合交易
+ */
+ public static final String EXCHANGE_B = "biue-exchange-B";
// 开多止盈队列
@@ -42,15 +63,33 @@
// 限价委托
public static final String QUEUE_LIMIT = "QUEUE_LIMIT_NEW";
+ // 委托平仓
+ public static final String QUEUE_LIMIT_CLOSE = "QUEUE_LIMIT_CLOSE_NEW";
+
// 爆仓队列
public static final String QUEUE_COINOUT = "QUEUE_COINOUT_NEW";
//价格操作
- public static final String QUEUE_PRICEOPERATE = "QUEUE_PRICEOPERATE";
+ public static final String QUEUE_PRICEOPERATE = "QUEUE_PRICEOPERATE_NEW";
// 平仓队列
- public static final String QUEUE_CLOSETRADE = "QUEUE_CLOSETRADE";
+ public static final String QUEUE_CLOSETRADE = "QUEUE_CLOSETRADE_NEW";
+ // 全仓爆仓
+ public static final String QUEUE_WHOLE_BOMB = "QUEUE_WHOLE_BOMB_NEW";
+
+ // 全仓价格操作
+ public static final String QUEUE_WHOLE_PRICE = "QUEUE_WHOLE_PRCE";
+
+ // 跟单下单
+ public static final String QUEUE_FOLLOW_ORDER = "QUEUE_FOLLOW_ORDER";
+
+ public static final String ROUTINGKEY_FOLLOW_ORDER = "ROUTINGKEY_FOLLOW_ORDER";
+
+ // 跟单调整保证金
+ public static final String QUEUE_FOLLOW_CHANGE_BOND = "QUEUE_FOLLOW_CHANGE_BOND";
+
+ public static final String ROUTINGKEY_FOLLOW_CHANGE_BOND = "ROUTINGKEY_FOLLOW_CHANGE_BOND";
// 开多止盈路由键
public static final String ROUTINGKEY_MOREPRO = "ROUTINGKEY_MOREPRO";
@@ -71,6 +110,29 @@
public static final String ROUTINGKEY_PRICEOPERATE = "ROUTINGKEY_PRICEOPERATE";
// 平仓路由
public static final String ROUTINGKEY_CLOSETRADE = "ROUTINGKEY_CLOSETRADE";
+
+ // 委托平仓
+ public static final String ROUTINGKEY_LIMIT_CLOSE = "ROUTINGKEY_LIMIT_CLOSE";
+
+ // 全仓爆仓
+ public static final String ROUTINGKEY_WHOLE_BOMB = "ROUTINGKEY_WHOLE_BOMB";
+
+ // 全仓价格操作
+ 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";
+
+ 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";
@Resource
private ConnectionFactory connectionFactory;
@@ -96,6 +158,58 @@
}
@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 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 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);
}
@@ -103,6 +217,39 @@
@Bean
public Binding binding() {
return BindingBuilder.bind(testQueue()).to(defaultExchange()).with(ROUTING_KEY_TEST);
+ }
+
+
+ @Bean
+ public DirectExchange usdtUpdateExchange() {
+ return new DirectExchange(EXCHANGE_USDT_UPDATE);
+ }
+
+
+ @Bean
+ public Queue usdtUpdateQueue() {
+ return new Queue(QUEUE_USDT_UPDATE, true);
+ }
+
+ @Bean
+ public Binding usdtUpdatebinding() {
+ return BindingBuilder.bind(usdtUpdateQueue()).to(usdtUpdateExchange()).with(ROUTING_KEY_USDT_UPDATE);
+ }
+
+ @Bean
+ public DirectExchange usdtAddressExchange() {
+ return new DirectExchange(EXCHANGE_USDT_ADDRESS);
+ }
+
+
+ @Bean
+ public Queue usdtAddressQueue() {
+ return new Queue(QUEUE_USDT_ADDRESS, true);
+ }
+
+ @Bean
+ public Binding usdtAddressbinding() {
+ return BindingBuilder.bind(usdtAddressQueue()).to(usdtAddressExchange()).with(ROUTING_KEY_USDT_ADDRESS);
}
@@ -171,6 +318,16 @@
return new Queue(QUEUE_LIMIT, true);
}
+ /**
+ * 委托平仓
+ *
+ * @return
+ */
+ @Bean
+ public Queue queueLimitClose() {
+ return new Queue(QUEUE_LIMIT_CLOSE, true);
+ }
+
/**
* 爆仓
@@ -202,6 +359,44 @@
return new Queue(QUEUE_CLOSETRADE, true);
}
+ @Bean
+ public Queue queueWholePrice() {
+ return new Queue(QUEUE_WHOLE_PRICE, true);
+ }
+ /**
+ * 全仓爆仓
+ * @return
+ */
+ @Bean
+ public Queue queueWholeBomb() {
+ return new Queue(QUEUE_WHOLE_BOMB, true);
+ }
+
+ @Bean
+ public Queue queueFollowOrder() {
+ return new Queue(QUEUE_FOLLOW_ORDER, true);
+ }
+
+ @Bean
+ public Queue queueFollowChangeBond() {
+ return new Queue(QUEUE_FOLLOW_CHANGE_BOND, true);
+ }
+
+ @Bean
+ public Binding bindingFollowChangeBond() {
+ return BindingBuilder.bind(queueFollowChangeBond()).to(orderExchange()).with(ROUTINGKEY_FOLLOW_CHANGE_BOND);
+ }
+
+ @Bean
+ public Binding bindingFollowOrder() {
+ return BindingBuilder.bind(queueFollowOrder()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_FOLLOW_ORDER);
+ }
+
+
+ @Bean
+ public Binding bindingWholePrice() {
+ return BindingBuilder.bind(queueWholePrice()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_WHOLE_PRICE);
+ }
/**
* 开多止盈
@@ -254,6 +449,15 @@
return BindingBuilder.bind(queueLimit()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_LIMIT);
}
+ /**
+ * 委托平仓
+ *
+ * @return
+ */
+ @Bean
+ public Binding bindingLimitClose() {
+ return BindingBuilder.bind(queueLimitClose()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_LIMIT_CLOSE);
+ }
/**
* 爆仓
@@ -286,4 +490,14 @@
return BindingBuilder.bind(queueCloseTrade()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_CLOSETRADE);
}
+ /**
+ * 全仓爆仓绑定
+ *
+ * @return
+ */
+ @Bean
+ public Binding bindingWholeBomb() {
+ return BindingBuilder.bind(queueWholeBomb()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_WHOLE_BOMB);
+ }
+
}
--
Gitblit v1.9.1