confluentinc / confluent-kafka-dotnet

Confluent's Apache Kafka .NET client
https://github.com/confluentinc/confluent-kafka-dotnet/wiki
Apache License 2.0
49 stars 857 forks source link

Add interfaces to `ProducerBuilder` and `ConsumerBuilder` #1973

Open deeja opened 1 year ago

deeja commented 1 year ago

Neither ConsumerBuilder or ProducerBuilder currently have an interface attached. When testing code that relates to the configuration of a consumer, it's difficult without reflection to check whether configs or handlers have been set.

In my code I've used an adapter to add an interface. An example of where this would be helpful is here: https://github.com/deeja/KafkaConsumerRetry/blob/main/KafkaConsumerRetry.Tests/Factories/LocalConsumerBuilderTests/BuildConsumerShould.cs#L18-L31

An example of this the change is here: https://github.com/confluentinc/confluent-kafka-dotnet/compare/master...deeja:confluent-kafka-dotnet:consumer_builder_interface

g7ed6e commented 3 weeks ago

Adding these interfaces will ease extensibility too by providing ability to implement a decorator pattern around the Confluent's builders. /cc @forlack / @Kielek / @CodeBlanch