Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use only foreach
  • Loading branch information
HyukjinKwon committed Jul 30, 2016
commit a1ef31129faa3c571bfd58c196ce3757eec890b8
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ private[kafka010] class KafkaTestUtils extends Logging {
/** Send the array of messages to the Kafka broker */
def sendMessages(topic: String, messages: Array[String]): Unit = {
producer = new KafkaProducer[String, String](producerConfiguration)
val records = messages.map { new ProducerRecord[String, String](topic, _) }
records.foreach(producer.send)
messages.foreach { message =>
producer.send(new ProducerRecord[String, String](topic, message))
}
producer.close()
producer = null
}
Expand Down