-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make consumer reading message header case insensitive (#2537)
- Loading branch information
Showing
5 changed files
with
72 additions
and
30 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Paramore.Brighter.MessagingGateway.Kafka/KafkaHeadersTools.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using Confluent.Kafka; | ||
|
||
namespace Paramore.Brighter.MessagingGateway.Kafka | ||
{ | ||
internal static class KafkaHeadersTools | ||
{ | ||
public static bool TryGetLastBytesIgnoreCase(this Headers headers, string key, out byte[] lastHeader) | ||
{ | ||
var header = headers.FirstOrDefault(h => h.Key.Equals(key, StringComparison.OrdinalIgnoreCase)); | ||
|
||
if (header == null) | ||
{ | ||
lastHeader = null; | ||
return false; | ||
} | ||
|
||
lastHeader = header.GetValueBytes(); | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters