Table of Contents

Class KafkaConsumerEndpointConfigurationBuilder<TMessage>

Namespace
Silverback.Messaging.Configuration.Kafka
Assembly
Silverback.Integration.Kafka.dll
public class KafkaConsumerEndpointConfigurationBuilder<TMessage> : ConsumerEndpointConfigurationBuilder<TMessage, KafkaConsumerEndpointConfiguration, KafkaConsumerEndpointConfigurationBuilder<TMessage>>

Type Parameters

TMessage

The type of the messages being consumed.

Inheritance
KafkaConsumerEndpointConfigurationBuilder<TMessage>
Inherited Members

Constructors

KafkaConsumerEndpointConfigurationBuilder(IServiceProvider, string?)

Initializes a new instance of the KafkaConsumerEndpointConfigurationBuilder<TMessage> class.

public KafkaConsumerEndpointConfigurationBuilder(IServiceProvider serviceProvider, string? friendlyName = null)

Parameters

serviceProvider IServiceProvider

The IServiceProvider.

friendlyName string

An optional friendly to be shown in the human-targeted output (e.g. logs, health checks result, etc.).

Properties

This

Gets this instance.

protected override KafkaConsumerEndpointConfigurationBuilder<TMessage> This { get; }

Property Value

KafkaConsumerEndpointConfigurationBuilder<TMessage>

Remarks

This is necessary to work around casting in the base classes.

Methods

ConsumeFrom(params TopicPartitionOffset[])

Specifies the topics and partitions to be consumed, as well as the starting offsets.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(params TopicPartitionOffset[] topicPartitionOffsets)

Parameters

topicPartitionOffsets TopicPartitionOffset[]

The topic partitions to be consumed and their starting offset.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(params TopicPartition[])

Specifies the topics and partitions to be consumed.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(params TopicPartition[] topicPartitions)

Parameters

topicPartitions TopicPartition[]

The topic partitions to be consumed.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(IEnumerable<string>, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>>)

Specifies the topics and a function that returns the partitions to be consumed, as well as the starting offsets.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(IEnumerable<string> topics, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> partitionOffsetsProvider)

Parameters

topics IEnumerable<string>

The topics.

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

A function that receives all available Confluent.Kafka.TopicPartition for the topics and returns the collection of Confluent.Kafka.TopicPartitionOffset containing the partitions to be consumed and their starting offsets.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(IEnumerable<string>, Func<IReadOnlyCollection<TopicPartition>, ValueTask<IEnumerable<TopicPartitionOffset>>>)

Specifies the topics and a function that returns the partitions to be consumed, as well as the starting offsets.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(IEnumerable<string> topics, Func<IReadOnlyCollection<TopicPartition>, ValueTask<IEnumerable<TopicPartitionOffset>>> partitionOffsetsProvider)

Parameters

topics IEnumerable<string>

The topics.

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

A function that receives all available Confluent.Kafka.TopicPartition for the topics and returns the collection of Confluent.Kafka.TopicPartitionOffset containing the partitions to be consumed and their starting offsets.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(string)

Specifies the topic to be subscribed.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(string topic)

Parameters

topic string

The topic.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(string, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>>)

Specifies the topic and a function that returns the partitions to be consumed, as well as the starting offsets.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(string topic, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> partitionOffsetsProvider)

Parameters

topic string

The topic.

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

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

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(string, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>)

Specifies the topic and a function that returns the partitions to be consumed.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(string topic, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> partitionsProvider)

Parameters

topic string

The topic.

partitionsProvider Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>

A function that receives all available Confluent.Kafka.TopicPartition for the topic and returns the collection of Confluent.Kafka.TopicPartition to be consumed.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(string, params int[])

Specifies the topic partitions to be consumed.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(string topic, params int[] partitions)

Parameters

topic string

The topic.

partitions int[]

The indexes of the partitions to be consumed.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(params string[])

Specifies the topics to be subscribed.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(params string[] topics)

Parameters

topics string[]

The topics to be subscribed.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

ConsumeFrom(string[], Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>)

Specifies the topics and a function that returns the partitions to be consumed, as well as the starting offsets.

public KafkaConsumerEndpointConfigurationBuilder<TMessage> ConsumeFrom(string[] topics, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> partitionsProvider)

Parameters

topics string[]

The topics.

partitionsProvider Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>

A function that receives all available Confluent.Kafka.TopicPartition for the topics and returns the collection of Confluent.Kafka.TopicPartition to be consumed.

Returns

KafkaConsumerEndpointConfigurationBuilder<TMessage>

The KafkaConsumerEndpointConfigurationBuilder<TMessage> so that additional calls can be chained.

CreateConfiguration()

Creates the TConfiguration instance.

protected override KafkaConsumerEndpointConfiguration CreateConfiguration()

Returns

KafkaConsumerEndpointConfiguration

The endpoint.