Customizing producer/consumer factories (#963)
* Customizing producer/consumer factories Adding hooks by providing Producer and Consumer config customizers to perform advanced configuration on the producer and consumer factories. Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/960 * Addressing PR review comments * Further PR updates
This commit is contained in:
@@ -735,3 +735,17 @@ public interface KafkaBindingRebalanceListener {
|
||||
====
|
||||
|
||||
You cannot set the `resetOffsets` consumer property to `true` when you provide a rebalance listener.
|
||||
|
||||
[[consumer-producer-config-customizer]]
|
||||
=== Customizing Consumer and Producer configuration
|
||||
|
||||
If you want advanced customization of consumer and producer configuration that is used for creating `ConsumerFactory` and `ProducerFactory` in Kafka,
|
||||
you can implement the following customizers.
|
||||
|
||||
* ConsusumerConfigCustomizer
|
||||
* ProducerConfigCustomizer
|
||||
|
||||
Both of these interfaces provide a way to configure the config map used for consumer and producer properties.
|
||||
For example, if you want to gain access to a bean that is defined at the application level, you can inject that in the implementation of the `configure` method.
|
||||
When the binder discovers that these customizers are available as beans, it will invoke the `configure` method right before creating the consumer and producer factories.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user