From 9a968ba186af5280fcc29cc3eb04412eff204ba7 Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Thu, 27 May 2021 16:37:33 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java | 99 +++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 99 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 6d6c947..00dcc4d 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
@@ -76,6 +78,18 @@
// 全仓爆仓
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";
@@ -103,6 +117,20 @@
// 全仓爆仓
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";
+
@Resource
private ConnectionFactory connectionFactory;
@@ -124,6 +152,47 @@
@Bean
public DirectExchange defaultExchange() {
return new DirectExchange(EXCHANGE_ONE);
+ }
+
+ @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
@@ -276,6 +345,10 @@
return new Queue(QUEUE_CLOSETRADE, true);
}
+ @Bean
+ public Queue queueWholePrice() {
+ return new Queue(QUEUE_WHOLE_PRICE, true);
+ }
/**
* 全仓爆仓
* @return
@@ -285,6 +358,32 @@
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);
+ }
+
/**
* 开多止盈
*
--
Gitblit v1.9.1