1.修改多线程配置,修复线程不复用的问题
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user