Skip to content

Commit

Permalink
[SPARK-12177][Streaming][Kafka] use a random port for embedded Kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
koeninger committed Jul 1, 2016
1 parent 22db76f commit 2f65fc1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private[kafka010] class KafkaTestUtils extends Logging {

// Kafka broker related configurations
private val brokerHost = "localhost"
private var brokerPort = 9092
private var brokerPort = 0
private var brokerConf: KafkaConfig = _

// Kafka broker server
Expand Down Expand Up @@ -110,7 +110,8 @@ private[kafka010] class KafkaTestUtils extends Logging {
brokerConf = new KafkaConfig(brokerConfiguration, doLog = false)
server = new KafkaServer(brokerConf)
server.startup()
(server, port)
brokerPort = server.boundPort()
(server, brokerPort)
}, new SparkConf(), "KafkaBroker")

brokerReady = true
Expand Down

0 comments on commit 2f65fc1

Please sign in to comment.