Tributary.Kafka.Producer
1.0.1
dotnet add package Tributary.Kafka.Producer --version 1.0.1
NuGet\Install-Package Tributary.Kafka.Producer -Version 1.0.1
<PackageReference Include="Tributary.Kafka.Producer" Version="1.0.1" />
<PackageVersion Include="Tributary.Kafka.Producer" Version="1.0.1" />
<PackageReference Include="Tributary.Kafka.Producer" />
paket add Tributary.Kafka.Producer --version 1.0.1
#r "nuget: Tributary.Kafka.Producer, 1.0.1"
#:package Tributary.Kafka.Producer@1.0.1
#addin nuget:?package=Tributary.Kafka.Producer&version=1.0.1
#tool nuget:?package=Tributary.Kafka.Producer&version=1.0.1
Tributary.Kafka.Producer
A .NET Kafka producer with sensible defaults. Wraps Akka.NET Streams Kafka under an opinionated, config-driven API.
dotnet add package Tributary.Kafka.Producer
Bootstrap
builder.Services.AddSharedKafkaProducer(builder.Configuration);
Publish
public sealed class OrdersService
{
private readonly IEventProducer _producer;
public OrdersService(IEventProducer producer) => _producer = producer;
public Task PublishAsync(OrderPlacedEvent evt, CancellationToken ct) =>
_producer.PublishAsync(
topic: "orders.placed",
message: evt,
key: evt.OrderId,
options: new PublishOptions
{
TenantId = "tenant_001",
EventType = "OrderPlaced"
},
cancellationToken: ct);
}
Every message is wrapped in an EventEnvelope<T> with auto-generated EventId, EventType, OccurredAt, and optional TenantId. The same fields are also attached as Kafka headers (event-id, event-type, occurred-at, tenant-id).
Config
{
"Kafka": {
"BootstrapServers": "your-broker:9092",
"SecurityProtocol": "SASL_SSL",
"SaslMechanism": "SCRAM-SHA-256",
"SaslUsername": "your-user",
"SaslPassword": "your-password",
"ClientId": "my-service-producer",
"EnableIdempotence": true
}
}
The producer applies only the properties you set, so the same code works against Aiven, AWS MSK, Confluent Cloud, or self-hosted Kafka — just change config.
For mTLS (e.g. Aiven Client Certificate auth), use SslCaLocation, SslCertificateLocation, SslKeyLocation instead of the SASL fields.
Idempotent producer (default on)
EnableIdempotence defaults to true, which automatically sets enable.idempotence=true and acks=all. This gives you exactly-once delivery at the producer→broker boundary (no duplicate writes on network retries) for negligible cost. Set to false only if you have a specific reason (legacy broker, throughput-critical fire-and-forget).
Failure handling
PublishAsync throws Confluent.Kafka.ProduceException on failure. The SDK does not swallow errors — your caller decides whether to retry, log, dead-letter, or fail the upstream request.
Common error codes:
| Error | Cause |
|---|---|
UnknownTopicOrPart |
Topic doesn't exist — create it or enable broker auto-create |
BrokerNotAvailable / NetworkException |
Can't reach brokers — check bootstrap servers + network |
AuthenticationFailed |
Bad mTLS cert or SASL credentials |
MessageSizeTooLarge |
Exceeds broker's message.max.bytes |
TopicAuthorizationFailed |
ACLs don't permit this client to write the topic |
Pair with the consumer
See Tributary.Kafka.Consumer for the matching consumer-side SDK with attribute-driven topic binding, configurable commit mode, and optional idempotency.
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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 was computed. 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. |
-
net8.0
- Akka.Streams.Kafka (>= 1.5.67)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.8)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.8)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.8)
- Tributary.Kafka.Abstractions (>= 1.0.1)
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 |
|---|---|---|
| 1.0.1 | 83 | 5/27/2026 |