消息队列全部出错,接收类型,修复

This commit is contained in:
Jack 2025-07-28 22:12:42 +08:00
parent 34583e3137
commit 28224ef6db

View File

@ -23,7 +23,6 @@ import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.IOException; import java.io.IOException;
import java.nio.charset.StandardCharsets;
/** /**
* 延迟消息接收器处理过期的消息 * 延迟消息接收器处理过期的消息
@ -44,11 +43,11 @@ public class DelayMessageReceiver {
private PushMessageService pushMessageService; private PushMessageService pushMessageService;
@RabbitListener(queues = MqConstant.DEAD_LETTER_QUEUE_NAME) @RabbitListener(queues = MqConstant.DEAD_LETTER_QUEUE_NAME)
public void handleExpiredMessage(byte[] data, Channel channel, Message message) { // public void handleExpiredMessage(byte[] data, Channel channel, Message message) {
// 将byte[]转换为String然后调用现有的处理逻辑 // // 将byte[]转换为String然后调用现有的处理逻辑
String dataStr = new String(data, StandardCharsets.UTF_8); // String dataStr = new String(data, StandardCharsets.UTF_8);
handleExpiredMessage(dataStr, channel, message); // handleExpiredMessage(dataStr, channel, message);
} // }
/** /**
* 监听死信队列处理过期的延迟消息 * 监听死信队列处理过期的延迟消息