Skip to content

Commit

Permalink
Simplify publish producer record method - remove unused topic argument (
Browse files Browse the repository at this point in the history
  • Loading branch information
lashchenko authored and manub committed Apr 8, 2018
1 parent 03270c0 commit aa350db
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,13 @@ sealed trait EmbeddedKafkaSupport {
/**
* Publishes synchronously a message to the running Kafka broker.
*
* @param topic the topic to which publish the message (it will be auto-created)
* @param producerRecord the producerRecord of type [[T]] to publish
* @param config an implicit [[EmbeddedKafkaConfig]]
* @param serializer an implicit [[Serializer]] for the type [[T]]
* @throws KafkaUnavailableException if unable to connect to Kafka
*/
@throws(classOf[KafkaUnavailableException])
def publishToKafka[T](topic: String, producerRecord: ProducerRecord[String, T])(
def publishToKafka[T](producerRecord: ProducerRecord[String, T])(
implicit config: EmbeddedKafkaConfig,
serializer: Serializer[T]): Unit =
publishToKafka(new KafkaProducer(baseProducerConfig.asJava,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class EmbeddedKafkaMethodsSpec
val headers = new RecordHeaders().add("my_header", headerValue.toCharArray.map(_.toByte))
val producerRecord = new ProducerRecord[String, String](topic, null, "key", message, headers)

publishToKafka(topic, producerRecord)
publishToKafka(producerRecord)

val consumer = kafkaConsumer
consumer.subscribe(List(topic).asJava)
Expand Down

0 comments on commit aa350db

Please sign in to comment.