Skip to content

Commit f09c4c4

Browse files
committed
修复RabbitMQ 重发bug
1 parent 06b627b commit f09c4c4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

spring-boot-student-rabbitmq/src/main/java/com/xiaolyuh/mq/sender/RabbitSender.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ public void sendMessage(String exchangeName, String routingKey, Object message)
5050

5151
// 获取CorrelationData对象
5252
CorrelationData correlationData = this.correlationData(message);
53+
correlationData.setExchange(exchangeName);
54+
correlationData.setRoutingKey(routingKey);
55+
correlationData.setMessage(message);
5356

5457
logger.info("发送MQ消息,消息ID:{},消息体:{}, exchangeName:{}, routingKey:{}",
5558
correlationData.getId(), JSON.toJSONString(message), exchangeName, routingKey);

spring-boot-student-rabbitmq/src/main/resources/application.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
server.port=80
1+
server.port=8081
22

33
# Rabbitmq
44
spring.rabbitmq.username=guest

0 commit comments

Comments
 (0)