![]() |
VOOZH | about |
dotnet add package ISC.Kafka.Extensions.Publisher --version 1.0.0
NuGet\Install-Package ISC.Kafka.Extensions.Publisher -Version 1.0.0
<PackageReference Include="ISC.Kafka.Extensions.Publisher" Version="1.0.0" />
<PackageVersion Include="ISC.Kafka.Extensions.Publisher" Version="1.0.0" />Directory.Packages.props
<PackageReference Include="ISC.Kafka.Extensions.Publisher" />Project file
paket add ISC.Kafka.Extensions.Publisher --version 1.0.0
#r "nuget: ISC.Kafka.Extensions.Publisher, 1.0.0"
#:package ISC.Kafka.Extensions.Publisher@1.0.0
#addin nuget:?package=ISC.Kafka.Extensions.Publisher&version=1.0.0Install as a Cake Addin
#tool nuget:?package=ISC.Kafka.Extensions.Publisher&version=1.0.0Install as a Cake Tool
ISC.Kafka.Extensions.Publisher is a lightweight .NET package for publishing messages to Kafka.
It provides two main integration flows:
IElasticLogger (log model is built and serialized automatically).IKafkaPublisher (full control over your payload).IElasticLogger for structured log publishingUse this flow when you want to publish logs in a standard model (LoggerModel<T>) with:
CreateDateLogLevelHttpStatusUrlMethodRequestBodyResource (ServiceName)ClientId (resolved from HttpContext.Items[Global.RESOURCE])using ISC.Kafka.Extensions.Publisher.Logging;
var loggerOptions = new ElasticLoggerModelOption
{
BootstrapServers = "localhost:9092",
Topic = "app-logs",
Username = "",
Password = "",
ServiceName = "OrderService"
};
IElasticLogger elasticLogger = new ElasticLogger(loggerOptions);
elasticLogger.Information(
message: "Create order success",
requestBody: "{\"orderId\":\"ORD-001\"}",
httpStatus: 200,
url: "/api/orders",
method: "POST");
await elasticLogger.ErrorAsync(
message: "Create order failed",
requestBody: "{\"orderId\":\"ORD-002\"}",
httpStatus: 500,
url: "/api/orders",
method: "POST");
ElasticLogger reads ClientId from:
HttpContext.Items[Global.RESOURCE]
Example middleware:
using ISC.Kafka.Extensions.Publisher.SeedWork;
app.Use(async (context, next) =>
{
context.Items[Global.RESOURCE] = context.Request.Headers["x-client-id"].ToString();
await next();
});
IKafkaPublisher for raw message publishingUse this flow when you want direct control over message content and key.
using ISC.Kafka.Extensions.Publisher;
IKafkaPublisher publisher = new KafkaPublisher(
bootstrapServers: "localhost:9092",
topic: "order-events",
username: "",
password: "");
PubMessageCustomAsyncvar payload = new
{
EventName = "OrderCreated",
OrderId = "ORD-1001",
CreatedAt = DateTime.UtcNow
};
var message = System.Text.Json.JsonSerializer.Serialize(payload);
await publisher.PubMessageCustomAsync(message, messageKey: "ORD-1001");
ErrorAsync, InformationAsync, PubMessageCustomAsync) for non-blocking I/O.ElasticLogger truncates very large requestBody values to avoid oversized Kafka messages.| 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.0 | 113 | 3/30/2026 |