agentsclimarketplace

Eventuous dotnet kafka

Skill Eventuous/eventuous-plugin/skills/eventuous-dotnet-kafka

This skill should be used when configuring Kafka integration with Eventuous. Covers KafkaBasicProducer for publishing to Kafka topics, Confluent.Kafka configuration, partition keys, message headers, and produce options. Common triggers: 'publish events to Kafka', 'Kafka producer', 'Kafka topic', 'KafkaBasicProducer', 'Confluent.Kafka with Eventuous'.From its SKILL.md

Install
npx -y skills add Eventuous/eventuous-plugin --skill eventuous-dotnet-kafka

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.2 KB, as published. Nobody here has run it

Eventuous Kafka Integration

NuGet package: Eventuous.Kafka Namespace: Eventuous.Kafka.Producers, Eventuous.Kafka.Subscriptions Source: src/Kafka/src/Eventuous.Kafka/

Uses Confluent.Kafka under the hood. Produces byte[] payloads with type info in Kafka headers (no schema registry).

Producer

KafkaBasicProducer extends BaseProducer<KafkaProduceOptions> and implements IHostedProducer, IAsyncDisposable.

// Constructor takes KafkaProducerOptions (wraps Confluent ProducerConfig)
public record KafkaProducerOptions(ProducerConfig ProducerConfig);

// Per-message produce options (partition key)
public record KafkaProduceOptions(string PartitionKey);

Instantiation

var options = new KafkaProducerOptions(new ProducerConfig {
    BootstrapServers = "localhost:9092"
});
await using var producer = new KafkaBasicProducer(options);
await producer.StartAsync(cancellationToken);

// Produce with partition key
await producer.Produce(
    new StreamName("my-topic"),
    events,
    new Metadata(),
    new KafkaProduceOptions("my-partition-key"),
    cancellationToken: ct
);

DI Registration

services.AddProducer<KafkaBasicProducer>(sp =>
    new KafkaBasicProducer(
        new KafkaProducerOptions(new ProducerConfig {
            BootstrapServers = "localhost:9092"
        })
    )
);

How it works

  • Serializes events using IEventSerializer, sends as byte[] values
  • Stores event type in message-type header and content type in content-type header (configurable via KafkaHeaderKeys)
  • When PartitionKey is provided, uses a keyed producer (IProducer<string, byte[]>); otherwise uses IProducer<Null, byte[]>
  • Metadata entries are converted to Kafka headers via MetadataExtensions.AsKafkaHeaders()
  • Supports delivery acknowledgement callbacks (OnAck/OnFail)
  • StopAsync flushes pending messages before stopping

Header Keys

public static class KafkaHeaderKeys {
    public static string MessageTypeHeader { get; set; } = "message-type";
    public static string ContentTypeHeader { get; set; } = "content-type";
}

Gateway Integration

To forward events from an event store subscription to Kafka topics, use the Eventuous Gateway. The stream name becomes the Kafka topic name. See the eventuous-dotnet-gateway skill for full gateway configuration details.

services.AddGateway<
    AllStreamSubscription,
    AllStreamSubscriptionOptions,
    KafkaBasicProducer,
    KafkaProduceOptions
>(
    "events-to-kafka",
    KafkaGateway.Transform
);

Key Behaviors

  • Topic mapping: The stream name passed to Produce becomes the Kafka topic name
  • Partition key: When using KafkaProduceOptions with a Key, messages with the same key go to the same partition (ordering guarantee)
  • Headers: Each message includes message-type and content-type headers, plus all metadata entries as additional headers
  • Flush on stop: The producer flushes pending messages when the hosted service stops
  • Keyed vs unkeyed: KafkaBasicProducer has two internal producers — one for keyed messages (with partition key) and one for unkeyed (round-robin)

Subscription

KafkaBasicSubscription extends EventSubscription<KafkaSubscriptionOptions>. Note: the subscription is currently a stub (throws NotImplementedException).

public record KafkaSubscriptionOptions : SubscriptionOptions {
    public ConsumerConfig ConsumerConfig { get; init; } = null!;
}

Note: The Kafka subscription is not yet implemented. For consuming Kafka messages in Eventuous event handlers, use Confluent.Kafka's ConsumerBuilder directly and route messages through your application layer. This limitation is tracked for a future release.

Tracing

Built-in OpenTelemetry tracing with:

  • MessagingSystem = "kafka"
  • DestinationKind = "topic"
  • ProduceOperation = "produce"

Keep looking

Skills are one crate of 608,475. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.