From eaf86c0c200d4a06adeb6b303fae5b0b4a66d96e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E9=9B=B7?= <284428564@QQ.com> Date: Wed, 5 Jun 2024 22:53:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TelpoPush.Position.Worker/Service/Mq/KafkaService.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/TelpoPush.Position.Worker/Service/Mq/KafkaService.cs b/TelpoPush.Position.Worker/Service/Mq/KafkaService.cs index 688aa97..796d8d2 100644 --- a/TelpoPush.Position.Worker/Service/Mq/KafkaService.cs +++ b/TelpoPush.Position.Worker/Service/Mq/KafkaService.cs @@ -97,7 +97,17 @@ namespace TelpoPush.Position.Worker.Service.Mq continue; } if (!string.IsNullOrEmpty(messageResult)) + { messageFunc(topic, messageResult, headers); + try + { + consumer.Commit(consumeResult); + } + catch (KafkaException e) + { + logger.LogError($" - {e.Message}."); + } + } #region 注释 //string messageResult = null; //Headers headers = null;