From 40ddd61501370f68ec0eea0e0883a59eb301e952 Mon Sep 17 00:00:00 2001 From: zainali5120 <512061637@qq.com> Date: Mon, 28 Sep 2020 14:34:17 +0800 Subject: [PATCH] CPV配置 --- src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java | 121 +++++++++++++++++++++++++++++++++++++--- 1 files changed, 111 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java index 7be7a45..3549a5f 100644 --- a/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java +++ b/src/main/java/com/xcong/excoin/configurations/RabbitMqConfig.java @@ -21,36 +21,46 @@ @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_B = "biue-exchange-B"; // 开多止盈队列 - public static final String QUEUE_MOREPRO = "QUEUE_MOREPRO"; + public static final String QUEUE_MOREPRO = "QUEUE_MOREPRO_NEW"; // 开空止盈队列 - public static final String QUEUE_LESSPRO = "QUEUE_LESSPRO"; + public static final String QUEUE_LESSPRO = "QUEUE_LESSPRO_NEW"; // 开多止损队列 - public static final String QUEUE_MORELOSS = "QUEUE_MORELOSS"; + public static final String QUEUE_MORELOSS = "QUEUE_MORELOSS_NEW"; // 开空止损队列 - public static final String QUEUE_LESSLOSS = "QUEUE_LESSLOSS"; + public static final String QUEUE_LESSLOSS = "QUEUE_LESSLOSS_NEW"; // 限价委托 public static final String QUEUE_LIMIT = "QUEUE_LIMIT_NEW"; // 爆仓队列 - public static final String QUEUE_COINOUT = "QUEUE_COINOUT"; + 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_TRADE_PLATE = "QUEUE_TRADE_PLATE"; + + // 处理交易 + public static final String QUEUE_HANDLE_TRADE = "QUEUE_HANDLE_TRADE"; // 开多止盈路由键 @@ -72,6 +82,19 @@ public static final String ROUTINGKEY_PRICEOPERATE = "ROUTINGKEY_PRICEOPERATE"; // 平仓路由 public static final String ROUTINGKEY_CLOSETRADE = "ROUTINGKEY_CLOSETRADE"; + + // 盘口理路由 + public static final String ROUTINGKEY_TRADE_PLATE = "ROUTINGKEY_TRADE_PLATE"; + + // 交易订单处理 + public static final String ROUTINGKEY_HANDLE_TRADE = "ROUTINGKEY_HANDLE_TRADE"; + + public static final String EXCHANGE_ROC = "roc-transfer"; + + public static final String QUEUE_ROC= "roc-queue"; + + public static final String ROUTING_KEY_ROC = "roc-transfer-routingKey"; + @Resource private ConnectionFactory connectionFactory; @@ -96,6 +119,7 @@ return new DirectExchange(EXCHANGE_ONE); } + @Bean public Queue testQueue() { return new Queue(QUEUE_TEST, true); @@ -118,9 +142,9 @@ } - /** * 开多止盈队列 + * * @return */ @Bean @@ -131,6 +155,7 @@ /** * 开空止盈队列 + * * @return */ @Bean @@ -141,6 +166,7 @@ /** * 开多止损 + * * @return */ @Bean @@ -151,6 +177,7 @@ /** * 开空止损 + * * @return */ @Bean @@ -161,6 +188,7 @@ /** * 限价委托 + * * @return */ @Bean @@ -171,6 +199,7 @@ /** * 爆仓 + * * @return */ @Bean @@ -180,6 +209,7 @@ /** * 价格操作 + * * @return */ @Bean @@ -189,6 +219,7 @@ /** * 价格操作 + * * @return */ @Bean @@ -197,9 +228,30 @@ } + /** + * 盘口推送 + * + * @return + */ + @Bean + public Queue queuePlateTrade() { + return new Queue(QUEUE_TRADE_PLATE, true); + } + + /** + * 交易订单处理 + * + * @return + */ + @Bean + public Queue queueHandleTrade() { + return new Queue(QUEUE_HANDLE_TRADE, true); + } + /** * 开多止盈 + * * @return */ @Bean @@ -209,6 +261,7 @@ /** * 开空止盈 + * * @return */ @Bean @@ -218,6 +271,7 @@ /** * 开多止损 + * * @return */ @Bean @@ -227,6 +281,7 @@ /** * 开空止损 + * * @return */ @Bean @@ -237,6 +292,7 @@ /** * 委托 + * * @return */ @Bean @@ -247,6 +303,7 @@ /** * 爆仓 + * * @return */ @Bean @@ -257,6 +314,7 @@ /** * 价格操作 + * * @return */ @Bean @@ -266,6 +324,7 @@ /** * 平仓绑定 + * * @return */ @Bean @@ -273,4 +332,46 @@ return BindingBuilder.bind(queueCloseTrade()).to(orderExchange()).with(RabbitMqConfig.ROUTINGKEY_CLOSETRADE); } + + @Bean + public DirectExchange matchTradeExchange() { + return new DirectExchange(EXCHANGE_B); + } + + /** + * 盘口变化绑定 + * + * @return + */ + @Bean + public Binding bindingPlateTrade() { + return BindingBuilder.bind(queuePlateTrade()).to(matchTradeExchange()).with(RabbitMqConfig.ROUTINGKEY_TRADE_PLATE); + } + + /** + * 交易订单处理 + * + * @return + */ + @Bean + public Binding bindingHandleTrade() { + return BindingBuilder.bind(queueHandleTrade()).to(matchTradeExchange()).with(RabbitMqConfig.ROUTINGKEY_HANDLE_TRADE); + } + + @Bean + public DirectExchange rocExchange() { + return new DirectExchange(EXCHANGE_ROC); + } + + + @Bean + public Queue rocQueue() { + return new Queue(QUEUE_ROC, true); + } + + @Bean + public Binding bindingRoc() { + return BindingBuilder.bind(rocQueue()).to(rocExchange()).with(ROUTING_KEY_ROC); + } + } -- Gitblit v1.9.1