From b00bf332e56e33b7850ae43204b0e3e1485b16ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=95=B8=E9=9D=9E?= <13281114856@qq.com> Date: Fri, 26 Aug 2022 14:00:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6=E5=AD=98?= =?UTF-8?q?=E5=82=A8=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/mortals/xhx/queue/DefaultTbCoreConsumerService.java | 2 ++ .../mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java | 1 + 2 files changed, 3 insertions(+) diff --git a/common-lib/src/main/java/com/mortals/xhx/queue/DefaultTbCoreConsumerService.java b/common-lib/src/main/java/com/mortals/xhx/queue/DefaultTbCoreConsumerService.java index 2b5bbf73..e2a8f00e 100644 --- a/common-lib/src/main/java/com/mortals/xhx/queue/DefaultTbCoreConsumerService.java +++ b/common-lib/src/main/java/com/mortals/xhx/queue/DefaultTbCoreConsumerService.java @@ -71,6 +71,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService<TbQueu } mainConsumer.commit(); + Thread.sleep(200); } catch (Exception e) { if (!stopped) { // log.warn("Failed to obtain messages from queue.", e); @@ -111,6 +112,7 @@ public class DefaultTbCoreConsumerService extends AbstractConsumerService<TbQueu } consumer.commit(); + Thread.sleep(200); } catch (Exception e) { if (!stopped) { try { diff --git a/common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java b/common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java index 4cc8dc93..c36d345a 100644 --- a/common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java +++ b/common-lib/src/main/java/com/mortals/xhx/queue/rabbitmq/TbRabbitMqConsumerTemplate.java @@ -59,6 +59,7 @@ public class TbRabbitMqConsumerTemplate<T extends TbQueueMsg> extends AbstractTb List<GetResponse> result = queues.stream() .map(queue -> { try { + GetResponse getResponse = channel.basicGet(queue, true); return getResponse; } catch (IOException e) { -- 2.24.3