From 0d30c93d000413c6eb34f489ef17688ad4175201 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 29 Apr 2024 18:18:21 +0800
Subject: [PATCH] 55测试环境
---
src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java | 29 +++++++++++++++++++----------
1 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java b/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java
index cd29a9e..c271571 100644
--- a/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java
+++ b/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java
@@ -2,6 +2,7 @@
import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSONObject;
import com.xcong.excoin.configurations.RabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.AmqpException;
@@ -15,6 +16,8 @@
import org.springframework.stereotype.Component;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
@Slf4j
@Component
@@ -32,26 +35,32 @@
rabbitTemplate.setConfirmCallback(this);
}
- public void sendMarketBussinessMsg(String content) {
+ public void sendMarketBussinessMsg(Long entrustOrderId, Integer status) {
log.info("发送市商消息");
CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
- rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_ONE, RabbitMqConfig.ROUTINGKEY_MARKET_BUSSINESS, content, correlationData);
+ Map<String, Object> map = new HashMap<>();
+ map.put("entrustOrderId", entrustOrderId);
+ map.put("status", status);
+ String s = JSONObject.toJSONString(map);
+ rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_ONE, RabbitMqConfig.ROUTINGKEY_MARKET_BUSSINESS, s, correlationData);
}
public void sendDelayOrderMsg(String content) {
log.info("-----{}", new Date());
CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
- amqpTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_DELAY, RabbitMqConfig.ROUTING_KEY_DELAY, content, new MessagePostProcessor() {
- @Override
- public Message postProcessMessage(Message message) throws AmqpException {
- //设置消息持久化
- message.getMessageProperties().setDeliveryMode(MessageDeliveryMode.PERSISTENT);
- message.getMessageProperties().setHeader("x-delay", 6000);//设置延时时间
- return message;
- }
+ rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_DELAY, RabbitMqConfig.ROUTING_KEY_DELAY, content, message -> {
+ message.getMessageProperties().setExpiration(6000 + "");
+ return message;
});
}
+ public void sendOrderReturn(String content) {
+ log.info("发送返佣消息");
+ CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
+ rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_ONE, RabbitMqConfig.ROUTING_ORDER_RETURN, content, correlationData);
+
+ }
+
@Override
public void confirm(CorrelationData correlationData, boolean b, String s) {
--
Gitblit v1.9.1