ConsumerFactory represents the ability to create a
new Kafka Consumer given ConsumerSettings. Normal
usage does not require a custom ConsumerFactory, but
it can be useful for testing purposes. If you can instead
have a custom trait or class similar to KafkaConsumer
for testing, then prefer that over having a custom
ConsumerFactory.
ConsumerFactory represents the ability to create a new Kafka
Consumer
given ConsumerSettings. Normal usage does not require a custom ConsumerFactory, but it can be useful for testing purposes. If you can instead have a custom trait or class similar to KafkaConsumer for testing, then prefer that over having a custom ConsumerFactory.To create a new ConsumerFactory, simply create a new instance and implement the create function with the desired
Consumer
behaviour. To use a custom instance of ConsumerFactory, you can simply set it with the ConsumerSettings#withConsumerFactory function.ConsumerFactory#Default is the default instance, and it creates a default
KafkaConsumer
instance from the provided ConsumerSettings.