Table of Contents

Class KafkaConsumerTuningOptions

Namespace
Excalibur.Dispatch.Transport.Kafka
Assembly
Excalibur.Dispatch.Transport.Kafka.dll

Consumer tuning options for Kafka batching, offset management, and session timeouts.

public sealed class KafkaConsumerTuningOptions
Inheritance
KafkaConsumerTuningOptions
Inherited Members
Extension Methods

Properties

AutoCommitIntervalMs

Gets or sets the auto-commit interval in milliseconds if EnableAutoCommit is true. Default is 5000ms (5 seconds).

[Range(100, 300000)]
public int AutoCommitIntervalMs { get; set; }

Property Value

int

The auto-commit interval in milliseconds if EnableAutoCommit is true. Default is 5000ms (5 seconds).

AutoOffsetReset

Gets or sets the auto offset reset policy. Valid values: "earliest", "latest", "none". Default is "latest".

public string AutoOffsetReset { get; set; }

Property Value

string

The auto offset reset policy. Valid values: "earliest", "latest", "none". Default is "latest".

EnableAutoCommit

Gets or sets a value indicating whether to automatically commit offsets. Default is false (manual commits for better control).

public bool EnableAutoCommit { get; set; }

Property Value

bool

A value indicating whether to automatically commit offsets. Default is false (manual commits for better control).

EnablePartitionEof

Gets or sets a value indicating whether to enable partition EOF detection. Default is false.

public bool EnablePartitionEof { get; set; }

Property Value

bool

A value indicating whether to enable partition EOF detection. Default is false.

MaxBatchSize

Gets or sets the maximum number of messages to consume in a single batch. Default is 100.

[Range(1, 10000)]
public int MaxBatchSize { get; set; }

Property Value

int

The maximum number of messages to consume in a single batch. Default is 100.

MaxBatchWaitMs

Gets or sets the maximum time to wait for a batch to fill in milliseconds. Default is 1000ms (1 second).

[Range(1, 60000)]
public int MaxBatchWaitMs { get; set; }

Property Value

int

The maximum time to wait for a batch to fill in milliseconds. Default is 1000ms (1 second).

MaxConcurrentCommits

Gets or sets the maximum number of concurrent offset commits. Default is 10.

[Range(1, 100)]
public int MaxConcurrentCommits { get; set; }

Property Value

int

The maximum number of concurrent offset commits. Default is 10.

MaxPayloadBytes

Gets or sets the maximum inbound-payload length, in bytes, enforced at consume ingress before the message body is materialized (defense-in-depth DoS hardening). An over-limit message is rejected before deserialization and skipped (its offset is committed past) rather than stalling the partition.

[Range(1, 2147483647)]
public int? MaxPayloadBytes { get; set; }

Property Value

int?

The maximum payload length in bytes. Default is 4 MiB (bounded by default so the guard is never inert; Kafka's own limits remain configurable above it). Set to null to opt out (unbounded) for larger legitimate payloads.

MaxPollIntervalMs

Gets or sets the maximum poll interval in milliseconds. Default is 300000ms (5 minutes).

[Range(10000, 1800000)]
public int MaxPollIntervalMs { get; set; }

Property Value

int

The maximum poll interval in milliseconds. Default is 300000ms (5 minutes).

PartitionAssignmentStrategy

Gets or sets the partition assignment strategy for the consumer group. Default is Confluent.Kafka.PartitionAssignmentStrategy.CooperativeSticky, which performs incremental rebalances so partitions not being reassigned keep consuming during a rebalance.

public PartitionAssignmentStrategy? PartitionAssignmentStrategy { get; set; }

Property Value

PartitionAssignmentStrategy?

The partition assignment strategy, or null to defer to the broker/client default. Ignored when GroupProtocol is the KIP-848 consumer protocol, where assignment is performed server-side.

QueuedMinMessages

Gets or sets the number of messages to prefetch per partition. Default is 1000.

[Range(1, 100000)]
public int QueuedMinMessages { get; set; }

Property Value

int

The number of messages to prefetch per partition. Default is 1000.

SessionTimeoutMs

Gets or sets the session timeout in milliseconds. Default is 30000ms (30 seconds).

[Range(1000, 300000)]
public int SessionTimeoutMs { get; set; }

Property Value

int

The session timeout in milliseconds. Default is 30000ms (30 seconds).