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_r182162754
##########
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:
i don't think it's necessary to retry at this time. if we do encounter
failed sending in the future then it is something we should revisit and likely
implement. this has less of a chance of failure compared to the produce action
----------------------------------------------------------------
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