![]() |
VOOZH | about |
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" />Directory.Packages.props
<PackageReference Include="Tributary.Kafka.Producer" />Project file
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.1Install as a Cake Addin
#tool nuget:?package=Tributary.Kafka.Producer&version=1.0.1Install as a Cake Tool
A .NET Kafka producer with sensible defaults. Wraps Akka.NET Streams Kafka under an opinionated, config-driven API.
dotnet add package Tributary.Kafka.Producer
builder.Services.AddSharedKafkaProducer(builder.Configuration);
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).
{
"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.
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).
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 |
See Tributary.Kafka.Consumer for the matching consumer-side SDK with attribute-driven topic binding, configurable commit mode, and optional idempotency.
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 95 | 5/27/2026 |