Break out DestroyKafkaConsumer function.
authorFrederik Vanrenterghem <frederik@vanrenterghem.io>
Thu, 13 Sep 2018 13:32:56 +0000 (21:32 +0800)
committerFrederik Vanrenterghem <frederik@vanrenterghem.io>
Thu, 13 Sep 2018 13:32:56 +0000 (21:32 +0800)
R/DestroyKafkaConsumer.R [new file with mode: 0644]
kafkaConsumer.R

diff --git a/R/DestroyKafkaConsumer.R b/R/DestroyKafkaConsumer.R
new file mode 100644 (file)
index 0000000..940535a
--- /dev/null
@@ -0,0 +1,7 @@
+DestroyKafkaConsumer <- function(consumer.base.uri) {
+  response <- DELETE(url = consumer.base.uri,
+         content_type("application/vnd.kafka.v2+json"))
+  if(response$status_code == 204) {
+    return(TRUE)
+    } else stop(response)
+}
\ No newline at end of file
index 6e8fe0b..8b5e6c7 100644 (file)
@@ -51,5 +51,5 @@ apachelog <- rbind(messages$value,messages2$value)
 createPlot(apachelog)
 
 # Remove the consumer
-DELETE(url = consumerDetails$base_uri,
-       content_type("application/vnd.kafka.v2+json"))
+source("R/DestroyKafkaConsumer.R")
+response <- DestroyKafkaConsumer(consumer.base.uri = consumerDetails$base_uri)