From f9e46337e7fcd248ff1892d14c5014d55864ce0f Mon Sep 17 00:00:00 2001 From: Savorboard Date: Mon, 27 Dec 2021 11:08:50 +0800 Subject: [PATCH] Tweak kafka read header by index when the Key already exists. --- src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs index ed235c8..29680e4 100644 --- a/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs +++ b/src/DotNetCore.CAP.Kafka/KafkaConsumerClient.cs @@ -106,7 +106,7 @@ namespace DotNetCore.CAP.Kafka var customHeaders = _kafkaOptions.CustomHeaders(consumerResult); foreach (var customHeader in customHeaders) { - headers.Add(customHeader.Key, customHeader.Value); + headers[customHeader.Key] = customHeader.Value; } } @@ -177,6 +177,6 @@ namespace DotNetCore.CAP.Kafka Reason = $"An error occurred during connect kafka --> {e.Reason}" }; OnLog?.Invoke(null, logArgs); - } + } } } \ No newline at end of file