From 7849f63f07721da2ed5486da1009f3bb2141d662 Mon Sep 17 00:00:00 2001 From: Marius Bogoevici Date: Wed, 24 Aug 2016 09:33:17 -0400 Subject: [PATCH] Create topic using dedicated AdminUtils call --- .../stream/binder/kafka/KafkaMessageChannelBinder.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java index 777956068..92ac41df1 100644 --- a/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java +++ b/spring-cloud-stream-binder-kafka/src/main/java/org/springframework/cloud/stream/binder/kafka/KafkaMessageChannelBinder.java @@ -454,17 +454,14 @@ public class KafkaMessageChannelBinder extends if (this.configurationProperties.isAutoCreateTopics()) { Seq brokerList = zkUtils.getSortedBrokerList(); // always consider minPartitionCount for topic creation - int effectivePartitionCount = Math.max(this.configurationProperties.getMinPartitionCount(), + final int effectivePartitionCount = Math.max(this.configurationProperties.getMinPartitionCount(), partitionCount); - final scala.collection.Map> replicaAssignment = AdminUtils - .assignReplicasToBrokers(brokerList, effectivePartitionCount, - this.configurationProperties.getReplicationFactor(), -1, -1); this.metadataRetryOperations.execute(new RetryCallback() { @Override public Object doWithRetry(RetryContext context) throws RuntimeException { - AdminUtils.createOrUpdateTopicPartitionAssignmentPathInZK(zkUtils, topicName, - replicaAssignment, topicConfig, true); + AdminUtils.createTopic(zkUtils, topicName, effectivePartitionCount, + configurationProperties.getReplicationFactor(), new Properties()); return null; } });