1.修改多线程配置,修复线程不复用的问题

This commit is contained in:
2025-07-08 15:19:59 +08:00
parent 12f4059ba0
commit 7aceb760a2
7 changed files with 44 additions and 15 deletions

View File

@@ -45,7 +45,7 @@ public class MQReceiver {
// }
@RabbitListener(queues = "HOST_INFO_QUEUE")
@Async
@Async("taskExecutor")
public void receive(List<NewHosts> hosts, Channel channel, Message message) throws IOException {
long deliveryTag = message.getMessageProperties().getDeliveryTag();
try {
@@ -62,7 +62,7 @@ public class MQReceiver {
}
@RabbitListener(queues = "BIG_BROTHER_QUEUE")
@Async
@Async("taskExecutor")
public void bigBrotherReceive(ServerBigBrother bigBrotherList, Channel channel, Message message) throws IOException {
long deliveryTag = message.getMessageProperties().getDeliveryTag();
try {
@@ -74,6 +74,7 @@ public class MQReceiver {
} catch (Exception e) {
channel.basicNack(deliveryTag, false, false);
log.error("消息消费失败");
log.error(e.getMessage());
throw new BusinessException(ErrorCode.QUEUE_CONSUMPTION_FAILURE);
}
}