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
Next Next commit
Use foreach instead of map
  • Loading branch information
HyukjinKwon committed Jul 30, 2016
commit b7a53f2902f5de0c4bca1dbaa76e4c70bfd92b86
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private[kafka010] class KafkaTestUtils extends Logging {
def sendMessages(topic: String, messages: Array[String]): Unit = {
producer = new KafkaProducer[String, String](producerConfiguration)
val records = messages.map { new ProducerRecord[String, String](topic, _) }
records.map(producer.send)
records.foreach(producer.send)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the point here was that you don't need to map at all; messages.foreach should suffice.

producer.close()
producer = null
}
Expand Down