FclEx.Kafka
2.4.8
dotnet add package FclEx.Kafka --version 2.4.8
NuGet\Install-Package FclEx.Kafka -Version 2.4.8
<PackageReference Include="FclEx.Kafka" Version="2.4.8" />
<PackageVersion Include="FclEx.Kafka" Version="2.4.8" />
<PackageReference Include="FclEx.Kafka" />
paket add FclEx.Kafka --version 2.4.8
#r "nuget: FclEx.Kafka, 2.4.8"
#:package FclEx.Kafka@2.4.8
#addin nuget:?package=FclEx.Kafka&version=2.4.8
#tool nuget:?package=FclEx.Kafka&version=2.4.8
FclEx.Kafka
Kafka consumer, serialization, header, and logging helpers built on Confluent.Kafka.
What Is Included
- Sequential consumers that commit offsets only after successful handling.
- Consumer configuration and message-handler options.
- JSON value deserializers and UTF-8 header helpers.
- Structured logging for Kafka errors and delivery results.
Usage Notes
- Reference the
FclEx.Kafkapackage and importFclEx.KafkaandConfluent.Kafka. - Connection settings use Confluent's
ConsumerConfigdirectly. - Integration tests require a reachable Kafka broker.
Kafka Consumer
Start the consumer from a ConsumerConfig and await the returned task for its entire lifetime:
var config = new ConsumerConfig
{
BootstrapServers = "localhost:9092",
GroupId = "orders",
AutoOffsetReset = AutoOffsetReset.Earliest,
};
await config.StartKafkaConsumer(new KafkaConsumerOptions<string>
{
Name = "order-handler",
Topic = "orders",
Deserializer = Deserializers.Utf8,
MessageHandler = HandleOrderAsync,
CancellationToken = stoppingToken,
});
The consumer copies the configuration and disables automatic commits and automatic offset storage.
It handles records sequentially and commits each offset only after its handler succeeds, including tombstones.
A handler, deserialization, polling, or commit failure stops the consumer. Later records cannot commit past a failed record.
ErrorHandler reports message-handler failures; completing it does not authorize committing the failed record.
If that callback also fails, the returned task retains the original handler exception.
Cancellation interrupts polling. In-flight handlers must observe the token themselves: successful work is still committed,
while a handler that throws OperationCanceledException after cancellation leaves its record uncommitted.
The consumer closes and disposes on exit. Resume with the same group to replay uncommitted records, subject to broker retention
and the configured offset-reset policy; use Earliest if a group with no committed offset must replay existing records.
Handlers must tolerate duplicate delivery when processing succeeds but committing its offset fails.
The previous ConsumerBuilder<string, T>.StartKafkaConsumer entry point has been replaced by
ConsumerConfig.StartKafkaConsumer, so this helper can own and enforce its offset-commit configuration.
Kafka Integration Tests
Tests use the shared CoreTestsFixture configuration. Set the Kafka section in
test/FclEx.Core.Tests/appsettings.json, with credentials in the ignored appsettings.decrypted.json
or appsettings.local.json beside it. The shared test project copies these files to the test output directory.
Property names match Confluent's ClientConfig, including BootstrapServers, SecurityProtocol,
SaslMechanism, SaslUsername, and SaslPassword. These integration tests require connection settings;
missing configuration does not skip them.
The test user needs permission to create/delete topics and consumer groups, produce/consume messages, and query committed offsets.
Tests use unique topics and group IDs and remove them after each case.
When a broker advertises localhost:9092, forward local port 9092 to the broker through SSH before running the tests.
For an IPv4-only tunnel, set Kafka:BrokerAddressFamily to V4 so advertised localhost addresses resolve consistently.
dotnet test test/FclEx.Kafka.Tests/FclEx.Kafka.Tests.csproj -c Release -f net10.0 --filter "FullyQualifiedName~FclEx.Kafka.ConsumerConfigExtensionsTests"
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
-
.NETStandard 2.0
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
-
net10.0
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
-
net11.0
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
-
net8.0
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
-
net9.0
- Confluent.Kafka (>= 2.16.0)
- FclEx.Logging (>= 2.4.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.4.8 | 50 | 11/13/2026 |