VOOZH about

URL: https://www.nuget.org/packages/PiBox.Plugins.Messaging.Kafka.Flow/

⇱ NuGet Gallery | PiBox.Plugins.Messaging.Kafka.Flow 1.1.2




👁 Image
PiBox.Plugins.Messaging.Kafka.Flow 1.1.2

dotnet add package PiBox.Plugins.Messaging.Kafka.Flow --version 1.1.2
 
 
NuGet\Install-Package PiBox.Plugins.Messaging.Kafka.Flow -Version 1.1.2
 
 
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="PiBox.Plugins.Messaging.Kafka.Flow" Version="1.1.2" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PiBox.Plugins.Messaging.Kafka.Flow" Version="1.1.2" />
 
Directory.Packages.props
<PackageReference Include="PiBox.Plugins.Messaging.Kafka.Flow" />
 
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 PiBox.Plugins.Messaging.Kafka.Flow --version 1.1.2
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PiBox.Plugins.Messaging.Kafka.Flow, 1.1.2"
 
 
#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 PiBox.Plugins.Messaging.Kafka.Flow@1.1.2
 
 
#: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=PiBox.Plugins.Messaging.Kafka.Flow&version=1.1.2
 
Install as a Cake Addin
#tool nuget:?package=PiBox.Plugins.Messaging.Kafka.Flow&version=1.1.2
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Kafka Flow Plugin

👁 PiBox framework

This plugin provides the nuget packages from KafkaFlow as Pibox plugin.

The containers that you need are also provided in the docker-compose.yaml file. You just need to configure the consumer(

  1. and the producer(s) and use them accordingly.

Installation

Install the Plugin via Nuget

dotnet add package PiBox.Plugins.Messaging.Kafka.Flow

or add as package reference to your .csproj

<PackageReference Include="PiBox.Plugins.Messaging.Kafka.Flow" Version=""/>

Appsettings.yml

Configure your appsettings.yml accordingly.

kafka:
 client:
 bootstrapServers: "localhost:9092,localhost:9093"
 # securityProtocol: "SaslPlaintext"
 # saslPassword: "asdf"
 # saslUsername: "asdf"
 # saslMechanism: "Plain"
 # sslCaLocation: ""
 # enableSslCertificateVerification: "false"
 schemaRegistry:
 url: "localhost:8081"
# basicAuthUserInfo: "developer:SECRET"
# enableSslCertificateVerification: "false"

Containers

The docker-compose.yaml will run the following containers:

  • zookeeper
  • broker
  • schema-registry
  • control-center

To run all containers

docker-compose up

To stop and remove the currently running containers

docker-compose down

Usage

Plugin configuration

public class KafkaFlowExamplePlugin : IPluginServiceConfiguration
 {
 private readonly IConfiguration _configuration;
 private readonly ILogger? _logger;

 public KafkaFlowExamplePlugin(IConfiguration configuration, ILogger<KafkaFlowExamplePlugin>? logger)
 {
 _configuration = configuration;
 _logger = logger;
 }

 //Configure your consumers & producers
 public void ConfigureServices(IServiceCollection serviceCollection)
 {
 serviceCollection.ConfigureKafka(_configuration, _logger, kafkaFlowBuilder => kafkaFlowBuilder
 //possible configurations:

 // producerConfig is none
 // producer is added to a Dictionary<Type, Action<IProducerConfigurationBuilder>>
 // type is typeof(TMessage)
 .AddTypedProducer<TMessage>("protobuf-topic")

 // producer is added to a Dictionary<Type, Action<IProducerConfigurationBuilder>>
 // type is typeof(TMessage)
 .AddTypedProducer<TMessage>("protobuf-topic", producerConfig)

 // producerConfig is none
 // producer is added to a List<(string, Action<IProducerConfigurationBuilder>)
 // the string added is typeof(TProducer).Name
 .AddProducer<TProducer>("protobuf-topic")

 // producer is added to a List<(string, Action<IProducerConfigurationBuilder>)
 // the string added is typeof(TProducer).Name
 .AddProducer<TProducer>("protobuf-topic", producerConfig)

 // consumer is added to a List<Action<IConsumerConfigurationBuilder>>
 .AddConsumer<TMessageHandler>("protobuf-topic", "mygroup"));

 // consumer is added to a List<Action<IConsumerConfigurationBuilder>>
 // dead letter message is produced on dead letter topic in case of unsuccessful processing of the message
 .AddConsumerWithDeadLetter<TMessageHandler, TMessage, TDeadLetterMessage>("protobuf-topic", "dead-letter-topic", "mygroup")
 }
 }

Click here to read more about the IServiceCollection interface.

Protobuf message format example
syntax = "proto3";
message TMessage {
 string Message = 1;
 int32 Code = 2;
}

Click here to read more about protobuf

Consumer usage

public class ProtobufMessageHandler : IMessageHandler<ProtobufLogMessage>
{
 public Task Handle(IMessageContext context, ProtobufLogMessage message)
 {
 // Do something
 }
}

Consumer with dead letter message producer usage

// The DltMessageHandler inherits from IMessageHandler<TMessage> (used to create a message handler)
// It also produces a dead letter message if there was an exception in ProcessMessageAsync
public class ProtobufDltMessageHandler : DltMessageHandler<TMessage, TDeadLetterMessage>
 {
 protected override async Task ProcessMessageAsync(IMessageContext context, TMessage message)
 {
 // Do something
 }

 protected override TDeadLetterMessage HandleError(IMessageContext context, TMessage message, Error error)
 {
 // Do something
 }
 }

Producer usage (optional)

public class SampleProducer
 {
 private readonly IMessageProducer _producer;

 public SampleProducer(IProducerAccessor producerAccessor)
 {
 _producer = producerAccessor.GetProducer("TProducer");
 }

 protected override async Task ExecuteAsync(CancellationToken stoppingToken)
 {
 _producer.ProduceAsync("protobuf-topic", messageKey, messageValue);
 }
 }
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. 
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.1.2 266 2/4/2025
1.0.91 214 1/24/2025
1.0.85 209 1/15/2025
1.0.79 229 12/20/2024
1.0.73 245 10/22/2024
1.0.66 207 10/15/2024
1.0.64 228 10/14/2024
1.0.61 218 10/1/2024
1.0.60 223 9/27/2024
1.0.54 292 4/30/2024
1.0.51 244 2/27/2024
1.0.49 234 2/27/2024
1.0.47 251 2/21/2024
1.0.45 273 2/20/2024
1.0.43 248 2/13/2024
1.0.41 251 2/13/2024
1.0.39 254 2/8/2024
1.0.38 267 2/8/2024
1.0.6 229 2/4/2025
1.0.4 217 2/4/2025
Loading failed