abaruni commented on a change in pull request #264: remove use of 
messageHubProduce action in health test and use java producer
URL: 
https://github.com/apache/incubator-openwhisk-package-kafka/pull/264#discussion_r182162353
 
 

 ##########
 File path: tests/src/test/scala/system/health/BasicHealthTest.scala
 ##########
 @@ -163,15 +166,21 @@ class BasicHealthTest
       val key = "TheKey"
 
       println("Producing a message")
-      withActivation(wsk.activation, 
wsk.action.invoke(s"$messagingPackage/$messageHubProduce", Map(
-        "user" -> kafkaUtils.getAsJson("user"),
-        "password" -> kafkaUtils.getAsJson("password"),
-        "kafka_brokers_sasl" -> kafkaUtils.getAsJson("brokers"),
-        "topic" -> topic.toJson,
-        "key" -> key.toJson,
-        "value" -> currentTime.toJson
-      ))) {
-        _.response.success shouldBe true
+      val producer = kafkaUtils.createProducer()
+      val record = new ProducerRecord(topic, key, currentTime)
+      val future = producer.send(record)
+
+      producer.flush()
+      producer.close()
 
 Review comment:
   ```
       /**
        * Close this producer. This method blocks until all previously sent 
requests complete.
        * This method is equivalent to <code>close(Long.MAX_VALUE, 
TimeUnit.MILLISECONDS)</code>.
   ```
   
   It should be safe. the call to flush will make it available immediately for 
sending. 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to