GH-1145: Remove destroying producer factory

Remove the un-ncessary call to destroy the producer when checking for partitions.
This way, the producer is cached and reused at the first time data is produced.

Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/1145
This commit is contained in:
Soby Chacko
2021-09-16 14:41:08 -04:00
committed by Gary Russell
parent 2b7f6ecb96
commit d57091d791

View File

@@ -399,9 +399,6 @@ public class KafkaMessageChannelBinder extends
List<PartitionInfo> partitionsFor = producer
.partitionsFor(destination.getName());
producer.close();
if (transMan == null) {
((DisposableBean) producerFB).destroy();
}
return partitionsFor;
}, destination.getName());
this.topicsInUse.put(destination.getName(),