xiaoyong931011
2020-06-02 d90e8bfffc0bf032499982b83813de307a6749e9
src/main/java/com/xcong/excoin/rabbit/producer/OrderProducer.java
@@ -1,6 +1,7 @@
package com.xcong.excoin.rabbit.producer;
import com.xcong.excoin.configurations.RabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate.ConfirmCallback;
@@ -13,6 +14,7 @@
/**
 * rabbitMq示例生产者
 */
@Slf4j
@Component
public class OrderProducer implements ConfirmCallback {
@@ -44,6 +46,7 @@
   /**
    * 开空止盈
     *
    * @param content
    */
   public void sendLessPro(String content) {
@@ -54,6 +57,7 @@
   /**
    * 开多止损
     *
    * @param content
    */
   public void sendMoreLoss(String content) {
@@ -64,6 +68,7 @@
   /**
    * 开空止损
     *
    * @param content
    */
   public void sendLessLoss(String content) {
@@ -74,6 +79,7 @@
   /**
    * 发送委托交易消息
     *
    * @param content
    */
   public void sendLimit(String content){
@@ -84,6 +90,7 @@
   /**
    * 发送爆仓消息
     *
    * @param content
    */
   public void sendCoinout(String content){
@@ -95,21 +102,23 @@
   /**
    * 发送价格操作消息
     *
    * @param content
    */
   public void sendPriceOperate(String content){
      CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
      System.out.println("发送价格操作:"+content+"==pid:"+correlationData.getId());
        log.info("发送价格操作 : {}==pid : {}", content, correlationData.getId());
      rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_PRICEOPERATE, content, correlationData);
   }
   /**
    * 发送平仓
     *
    * @param content
    */
   public void sendCloseTrade(String content){
      CorrelationData correlationData = new CorrelationData(UUID.randomUUID().toString());
      System.out.println("发送平仓消息:"+content+"==pid:"+correlationData.getId());
        log.info("发送平仓消息:{}==pid : {}", content, correlationData.getId());
      rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_A, RabbitMqConfig.ROUTINGKEY_CLOSETRADE, content, correlationData);
   }