| | |
| | | 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; |
| | |
| | | /** |
| | | * rabbitMq示例生产者 |
| | | */ |
| | | @Slf4j |
| | | @Component |
| | | public class OrderProducer implements ConfirmCallback { |
| | | |
| | |
| | | |
| | | /** |
| | | * 开空止盈 |
| | | * |
| | | * @param content |
| | | */ |
| | | public void sendLessPro(String content) { |
| | |
| | | |
| | | /** |
| | | * 开多止损 |
| | | * |
| | | * @param content |
| | | */ |
| | | public void sendMoreLoss(String content) { |
| | |
| | | |
| | | /** |
| | | * 开空止损 |
| | | * |
| | | * @param content |
| | | */ |
| | | public void sendLessLoss(String content) { |
| | |
| | | |
| | | /** |
| | | * 发送委托交易消息 |
| | | * |
| | | * @param content |
| | | */ |
| | | public void sendLimit(String content){ |
| | |
| | | |
| | | /** |
| | | * 发送爆仓消息 |
| | | * |
| | | * @param content |
| | | */ |
| | | public void sendCoinout(String content){ |
| | |
| | | |
| | | /** |
| | | * 发送价格操作消息 |
| | | * |
| | | * @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); |
| | | } |
| | | |