spring-cloud / spring-cloud-stream-binder-kafka

Spring Cloud Stream binders for Apache Kafka and Kafka Streams
Apache License 2.0
331 stars 301 forks source link

Reconsider Destroying Producer Factory #1145

Closed garyrussell closed 3 years ago

garyrussell commented 3 years ago

It is not clear why the producer factory is destroyed after creating a producer to check the partitions.

https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/pull/626

This changed it to only destroy when transactions are not enabled because it caused undesirable side effects because the factory is shared.

However, there is no reason that the producer cached by this operation can't remain in the cache for use by producer bindings.

The only reason I can think of is that if the application never produces any data, the producer will sit there unused, but that seems unusual.

garyrussell commented 3 years ago

https://gitter.im/spring-cloud/spring-cloud-stream?at=614212518065e87a8ee50dc9