Publo.Kafka 1.0.1

dotnet add package Publo.Kafka --version 1.0.1
                    
NuGet\Install-Package Publo.Kafka -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Publo.Kafka" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Publo.Kafka" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Publo.Kafka" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Publo.Kafka --version 1.0.1
                    
#r "nuget: Publo.Kafka, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Publo.Kafka@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Publo.Kafka&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=Publo.Kafka&version=1.0.1
                    
Install as a Cake Tool

Publo.Kafka

Kafka provider for Publo broadcast events. It publishes events to one Kafka topic and runs a hosted consumer that dispatches events to IPubloExecutor<T> handlers in each running pod or application instance.

The provider uses Confluent.Kafka and stores the .NET message type in the Kafka message key so the consumer can resolve the matching executor.

Use this provider when your services already have Kafka-compatible infrastructure and you want an easy way to notify every running pod about cluster-wide events such as cache invalidations, configuration refreshes, and local state updates.

Installation

dotnet add package Publo.Kafka

Registration

using Publo.Abstraction.Extensions;
using Publo.Kafka.Extensions;

builder.Services
    .AddPublo(publo => publo.UseKafka())
    .AddPubloExecutor<UserCreated, UserCreatedExecutor>();

Configuration

UseKafka binds options from the KafkaPubloOptions configuration section:

{
  "KafkaPubloOptions": {
    "topic": "events",
    "skipPolicy": "Soft",
    "consumerConfig": {
      "bootstrap.servers": "localhost:9092",
      "auto.offset.reset": "Latest"
    },
    "producerConfig": {
      "bootstrap.servers": "localhost:9092"
    }
  }
}

Options:

Name Default Description
Topic empty string Kafka topic used for producing and consuming Publo broadcast events.
SkipPolicy Soft Controls how unsupported messages are handled.
ConsumerConfig empty dictionary Values passed to Confluent.Kafka.ConsumerConfig.
ProducerConfig empty dictionary Values passed to Confluent.Kafka.ProducerConfig.

SkipPolicy.Strict throws when the consumer cannot read, resolve, or deserialize a message. SkipPolicy.Soft skips unsupported messages when possible and continues processing.

Publishing And Handling

using Publo.Abstraction.Executor;
using Publo.Abstraction.Services;

public sealed record UserCreated(Guid UserId);

public sealed class UserCreatedExecutor : IPubloExecutor<UserCreated>
{
    public Task HandleAsync(UserCreated message, CancellationToken cancellationToken)
    {
        // React to the broadcast event here.
        return Task.CompletedTask;
    }
}

public sealed class UsersService(IPubloService publo)
{
    public Task PublishAsync(Guid userId, CancellationToken cancellationToken)
        => publo.SendAsync(new UserCreated(userId), cancellationToken);
}

Local Kafka

The repository docker-compose.yaml starts Redpanda on localhost:9092 and creates a test topic:

docker compose up -d kafka redpanda-setup redpanda-console

Redpanda Console is exposed at http://localhost:9000.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 117 6/6/2026
1.0.0 116 5/24/2026