|
@@ -8,6 +8,7 @@ import com.xs.core.model.coin.msg.RetryableMessage;
|
|
|
import com.xs.core.model.coin.msg.TeamShareMessage;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.amqp.core.MessageDeliveryMode;
|
|
|
+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;
|
|
@@ -35,7 +36,7 @@ public class GoldCoinMessageProducer {
|
|
|
//延时10秒
|
|
|
msg.getMessageProperties().setHeader("x-delay", 10 * 1000L);
|
|
|
return msg;
|
|
|
- });
|
|
|
+ }, new CorrelationData(coinProducerMessage.getMsgId()));
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -46,7 +47,7 @@ public class GoldCoinMessageProducer {
|
|
|
*/
|
|
|
public void sendCalculationCompleteMessage(CoinProducerMessage coinProducerMessage) {
|
|
|
sendMessageWithRetry(coinProducerMessage, MAX_RETRY_COUNT, m -> {
|
|
|
- rabbitTemplate.convertAndSend(RabbitMQConfig.GOLD_COIN_COMPLETE_EXCHANGE, RabbitMQConfig.GOLD_COIN_COMPLETE_QUEUE, JSON.toJSONString(m));
|
|
|
+ rabbitTemplate.convertAndSend(RabbitMQConfig.GOLD_COIN_COMPLETE_EXCHANGE, RabbitMQConfig.GOLD_COIN_COMPLETE_QUEUE, JSON.toJSONString(m),new CorrelationData(coinProducerMessage.getMsgId()));
|
|
|
log.info("发送计算结束的消息: {}", JSON.toJSONString(m));
|
|
|
});
|
|
|
}
|
|
@@ -61,7 +62,7 @@ public class GoldCoinMessageProducer {
|
|
|
//延时5秒
|
|
|
msg.getMessageProperties().setHeader("x-delay", 5 * 1000L);
|
|
|
return msg;
|
|
|
- }));
|
|
|
+ },new CorrelationData(teamShareMessage.getMsgId())));
|
|
|
}
|
|
|
|
|
|
/**
|