Table of Contents

Class KafkaConsumerEndpointConfiguration

Namespace
Silverback.Messaging.Configuration.Kafka
Assembly
Silverback.Integration.Kafka.dll

The Kafka consumer endpoint configuration.

public sealed record KafkaConsumerEndpointConfiguration : ConsumerEndpointConfiguration, IEquatable<EndpointConfiguration>, IEquatable<ConsumerEndpointConfiguration>, IEquatable<KafkaConsumerEndpointConfiguration>
Inheritance
KafkaConsumerEndpointConfiguration
Implements
Inherited Members

Constructors

KafkaConsumerEndpointConfiguration()

public KafkaConsumerEndpointConfiguration()

Properties

EqualityContract

protected override Type EqualityContract { get; }

Property Value

Type

PartitionOffsetsProvider

Gets a function that receives all available Confluent.Kafka.TopicPartition for the topic(s) and returns the collection of Confluent.Kafka.TopicPartitionOffset containing the partitions to be consumed and their starting offsets.

public Func<IReadOnlyCollection<TopicPartition>, ValueTask<IEnumerable<TopicPartitionOffset>>>? PartitionOffsetsProvider { get; init; }

Property Value

Func<IReadOnlyCollection<TopicPartition>, ValueTask<IEnumerable<TopicPartitionOffset>>>

TopicPartitions

Gets the topics and partitions to be consumed.

Setting the partition to Confluent.Kafka.Partition.Any for a topic will cause it to be subscribed to get a partition assignment from the message broker, unless a PartitionOffsetsProvider is set. An IKafkaPartitionsAssignedCallback can be registered to interact with the partitions assignment process.

Setting the partition to Confluent.Kafka.Partition.Any for a topic and setting a PartitionOffsetsProvider will cause the consumer to retrieve the topics metadata, collect all available partitions and call the specified resolver function. The result of the function will be used as static partition assignment for the consumer.

Setting the offset to Confluent.Kafka.Offset.Unset means that the offset stored on the message broker will be used. If no offset was stored on the server the Configuration.AutoOffsetReset property will determine where to start consuming.

public IValueReadOnlyCollection<TopicPartitionOffset> TopicPartitions { get; init; }

Property Value

IValueReadOnlyCollection<TopicPartitionOffset>

Methods

Equals(ConsumerEndpointConfiguration?)

public override sealed bool Equals(ConsumerEndpointConfiguration? other)

Parameters

other ConsumerEndpointConfiguration

Returns

bool

Equals(KafkaConsumerEndpointConfiguration?)

public bool Equals(KafkaConsumerEndpointConfiguration? other)

Parameters

other KafkaConsumerEndpointConfiguration

Returns

bool

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected override bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

ValidateCore()

Validates the endpoint configuration and throws an BrokerConfigurationException if not valid.

protected override void ValidateCore()

Operators

operator ==(KafkaConsumerEndpointConfiguration?, KafkaConsumerEndpointConfiguration?)

public static bool operator ==(KafkaConsumerEndpointConfiguration? left, KafkaConsumerEndpointConfiguration? right)

Parameters

left KafkaConsumerEndpointConfiguration
right KafkaConsumerEndpointConfiguration

Returns

bool

operator !=(KafkaConsumerEndpointConfiguration?, KafkaConsumerEndpointConfiguration?)

public static bool operator !=(KafkaConsumerEndpointConfiguration? left, KafkaConsumerEndpointConfiguration? right)

Parameters

left KafkaConsumerEndpointConfiguration
right KafkaConsumerEndpointConfiguration

Returns

bool