Skip to content

feat: KafkaTransportOptions for configurable Kafka outbox transport #234

@samtrion

Description

@samtrion

User Story

As a developer configuring the Kafka outbox transport, I want a KafkaTransportOptions class with configurable partition count, replication factor, topic auto-creation, and message retention, so that I can tune Kafka topic behavior without modifying transport internals.


Background

KafkaMediatorConfiguratorExtensions.UseKafkaTransport() accepts no options. KafkaMessageTransport creates topics with hard-coded DefaultPartitionCount = 1 and DefaultReplicationFactor = 1. All other Pulse transports (RabbitMqTransportOptions, AzureServiceBusTransportOptions, DaprMessageTransportOptions) provide a dedicated options class. Kafka is the sole exception.


Requirements

  • Create KafkaTransportOptions in NetEvolve.Pulse.Kafka:
    public sealed class KafkaTransportOptions
    {
        public int DefaultPartitionCount { get; set; } = 1;
        public short DefaultReplicationFactor { get; set; } = 1;
        public bool AutoCreateTopics { get; set; } = true;
        public TimeSpan? MessageRetention { get; set; }
    }
  • Update KafkaMessageTransport to inject IOptions<KafkaTransportOptions> and use the configured values for topic creation.
  • Extend UseKafkaTransport() with Action<KafkaTransportOptions>? configureOptions = null parameter and register options accordingly.

Acceptance Criteria

  • KafkaTransportOptions properties have documented defaults matching the current hard-coded values.
  • KafkaMessageTransport uses options.DefaultPartitionCount and options.DefaultReplicationFactor for topic creation.
  • When AutoCreateTopics = false, topic creation is skipped.
  • MessageRetention is applied to the topic config when set.
  • UseKafkaTransport() without a configure delegate behaves identically to the current implementation.
  • Unit tests cover: custom partition count, custom replication factor, AutoCreateTopics = false, custom retention.

Out of Scope

  • Per-topic options overrides.
  • Consumer group configuration.

Metadata

Metadata

Labels

type:featureIndicates a new feature or enhancement to be added.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions