You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/04/17 17:11:12 UTC

[GitHub] dubee commented on a change in pull request #264: remove use of messageHubProduce action in health test and use java producer

dubee 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_r182158205
 
 

 ##########
 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()
+
+      try {
+        val result = future.get(60, TimeUnit.SECONDS)
+
+        println(s"Produced record to topic: ${result.topic()} on partition: ${result.partition()} at offset: ${result.offset()} with key: $key and value: $currentTime.")
+      } catch {
 
 Review comment:
   Should we retry the send if an exception occurs? 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services