From f6a912c1a6a26c809568f964941fb4ad4483274e Mon Sep 17 00:00:00 2001
From: Helius <wangdoubleone@gmail.com>
Date: Mon, 31 May 2021 11:19:40 +0800
Subject: [PATCH] modify
---
src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 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 cdee752..7d530f3 100644
--- a/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java
+++ b/src/main/java/com/xcong/excoin/rabbit/producer/OtcProducter.java
@@ -4,10 +4,17 @@
import cn.hutool.core.util.IdUtil;
import com.xcong.excoin.configurations.RabbitMqConfig;
import lombok.extern.slf4j.Slf4j;
+import org.springframework.amqp.AmqpException;
+import org.springframework.amqp.core.AmqpTemplate;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.core.MessageDeliveryMode;
+import org.springframework.amqp.core.MessagePostProcessor;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+
+import java.util.Date;
@Slf4j
@Component
@@ -15,6 +22,9 @@
@Autowired
private RabbitTemplate rabbitTemplate;
+
+ @Autowired
+ private AmqpTemplate amqpTemplate;
@Autowired
public OtcProducter(RabbitTemplate rabbitTemplate) {
@@ -28,6 +38,15 @@
rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_ONE, RabbitMqConfig.ROUTINGKEY_MARKET_BUSSINESS, content, correlationData);
}
+ public void sendDelayOrderMsg(String content) {
+ log.info("-----{}", new Date());
+ CorrelationData correlationData = new CorrelationData(IdUtil.simpleUUID());
+ rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_DELAY, RabbitMqConfig.ROUTING_KEY_DELAY, content, message -> {
+ message.getMessageProperties().setExpiration(6000 + "");
+ return message;
+ });
+ }
+
@Override
public void confirm(CorrelationData correlationData, boolean b, String s) {
--
Gitblit v1.9.1