Class KafkaConsumerEndpointBuilder
Builds the KafkaConsumerEndpoint.
Inheritance
Implements
Inherited Members
Namespace: Silverback.Messaging.Configuration.Kafka
Assembly: Silverback.Integration.Kafka.dll
Syntax
public class KafkaConsumerEndpointBuilder : ConsumerEndpointBuilder<KafkaConsumerEndpoint, IKafkaConsumerEndpointBuilder>, IKafkaConsumerEndpointBuilder, IConsumerEndpointBuilder<IKafkaConsumerEndpointBuilder>, IEndpointBuilder<IKafkaConsumerEndpointBuilder>
Constructors
| Improve this doc View sourceKafkaConsumerEndpointBuilder(KafkaClientConfig?, Type?, IEndpointsConfigurationBuilder?)
Initializes a new instance of the KafkaConsumerEndpointBuilder class.
Declaration
public KafkaConsumerEndpointBuilder(KafkaClientConfig? clientConfig = null, Type? messageType = null, IEndpointsConfigurationBuilder? endpointsConfigurationBuilder = null)
Parameters
| Type | Name | Description |
|---|---|---|
| KafkaClientConfig | clientConfig | The KafkaClientConfig to be used to initialize the KafkaConsumerConfig. |
| Type | messageType | The type of the message being consumed. |
| IEndpointsConfigurationBuilder | endpointsConfigurationBuilder | The optional reference to the IEndpointsConfigurationBuilder that instantiated the builder. |
Properties
| Improve this doc View sourceThis
Gets this instance.
Declaration
protected override IKafkaConsumerEndpointBuilder This { get; }
Property Value
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder |
Overrides
Remarks
This is necessary to work around casting in the base classes.
Methods
| Improve this doc View sourceConfigure(Action<KafkaConsumerConfig>)
Configures the Kafka client properties.
Declaration
public IKafkaConsumerEndpointBuilder Configure(Action<KafkaConsumerConfig> configAction)
Parameters
| Type | Name | Description |
|---|---|---|
| Action<KafkaConsumerConfig> | configAction | An Action<T> that takes the IKafkaConsumerEndpointBuilder and configures it. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(params TopicPartitionOffset[])
Specifies the topics and partitions to be consumed.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(params TopicPartitionOffset[] topicPartitions)
Parameters
| Type | Name | Description |
|---|---|---|
| TopicPartitionOffset[] | topicPartitions | The topics and partitions to be consumed and the starting offset. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(params TopicPartition[])
Specifies the topics and partitions to be consumed.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(params TopicPartition[] topicPartitions)
Parameters
| Type | Name | Description |
|---|---|---|
| TopicPartition[] | topicPartitions | The topics and partitions to be consumed. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(string, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>>)
Specifies the name of the topic to be consumed and a function that returns the partitions to be assigned.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(string topicName, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> topicPartitionsResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicName | The name of the topic. |
| Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> | topicPartitionsResolver | A function that receives all available Confluent.Kafka.TopicPartition for the topic and returns the collection of Confluent.Kafka.TopicPartitionOffset to be assigned. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(string, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>)
Specifies the name of the topic to be consumed and a function that returns the partitions to be assigned.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(string topicName, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> topicPartitionsResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| string | topicName | The name of the topic. |
| Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> | topicPartitionsResolver | A function that receives all available Confluent.Kafka.TopicPartition for the topic and returns the collection of Confluent.Kafka.TopicPartition to be assigned. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(params string[])
Specifies the name of the topics to be consumed.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(params string[] topicNames)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | topicNames | The name of the topics. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(string[], Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>>)
Specifies the name of the topic to be consumed and a function that returns the partitions to be assigned.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(string[] topicNames, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> topicPartitionsResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | topicNames | The name of the topics. |
| Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartitionOffset>> | topicPartitionsResolver | A function that receives all available Confluent.Kafka.TopicPartition for the topics and returns the collection of Confluent.Kafka.TopicPartitionOffset to be assigned. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ConsumeFrom(string[], Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>>)
Specifies the name of the topic to be consumed and a function that returns the partitions to be assigned.
Declaration
public IKafkaConsumerEndpointBuilder ConsumeFrom(string[] topicNames, Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> topicPartitionsResolver)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | topicNames | The name of the topics. |
| Func<IReadOnlyCollection<TopicPartition>, IEnumerable<TopicPartition>> | topicPartitionsResolver | A function that receives all available Confluent.Kafka.TopicPartition for the topics and returns the collection of Confluent.Kafka.TopicPartition to be assigned. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
CreateEndpoint()
Creates the endpoint to be configured according to the options stored in the builder.
Declaration
protected override KafkaConsumerEndpoint CreateEndpoint()
Returns
| Type | Description |
|---|---|
| KafkaConsumerEndpoint | The endpoint. |
Overrides
| Improve this doc View sourceLimitBackpressure(int)
Sets the maximum number of messages to be consumed and enqueued waiting to be processed. The limit will be applied per partition when processing the partitions independently (default). The default limit is 1.
Declaration
public IKafkaConsumerEndpointBuilder LimitBackpressure(int backpressureLimit)
Parameters
| Type | Name | Description |
|---|---|---|
| int | backpressureLimit | The maximum number of messages to be enqueued. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
LimitParallelism(int)
Sets the maximum number of incoming message that can be processed concurrently. Up to a message per each subscribed partition can be processed in parallel. The default limit is 10.
Declaration
public IKafkaConsumerEndpointBuilder LimitParallelism(int maxDegreeOfParallelism)
Parameters
| Type | Name | Description |
|---|---|---|
| int | maxDegreeOfParallelism | The maximum number of incoming message that can be processed concurrently. |
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ProcessAllPartitionsTogether()
Specifies that all partitions must be processed together. This means that a single stream will published for the messages from all the partitions and the sequences (ChunkSequence, BatchSequence, ...) can span across the partitions.
Declaration
public IKafkaConsumerEndpointBuilder ProcessAllPartitionsTogether()
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |
ProcessPartitionsIndependently()
Specifies that the partitions must be processed independently. This means that a stream will published per each partition and the sequences (ChunkSequence, BatchSequence, ...) cannot span across the partitions. This option is enabled by default. Use ProcessAllPartitionsTogether() to disable it.
Declaration
public IKafkaConsumerEndpointBuilder ProcessPartitionsIndependently()
Returns
| Type | Description |
|---|---|
| IKafkaConsumerEndpointBuilder | The IKafkaConsumerEndpointBuilder so that additional calls can be chained. |