summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7738dcb)
* Call function from yet unlinked script to plot and forecast.
* Iterate twice to verify the script works with streaming content.
library(httr)
library(jsonlite)
library(httr)
library(jsonlite)
kafka_rest_proxy <- "http://localhost:8082"
# Create consumer
kafka_rest_proxy <- "http://localhost:8082"
# Create consumer
response
# Obtain all messages on the topic
response
# Obtain all messages on the topic
-messages <- GET(url = paste(kafka_rest_proxy,"consumers","my_json_consumer","instances","my_consumer_instance","records", sep = "/"),
+messagesJSON <- GET(url = paste(kafka_rest_proxy,"consumers","my_json_consumer","instances","my_consumer_instance","records", sep = "/"),
accept("application/vnd.kafka.json.v2+json"),
encode="json")
accept("application/vnd.kafka.json.v2+json"),
encode="json")
-apachelog <- fromJSON(content(messages,"text"))
+messages <- fromJSON(content(messagesJSON,"text"))
+
+createPlot(messages$value)
+
+Sys.sleep(120)
+
+messagesJSON <- GET(url = paste(kafka_rest_proxy,"consumers","my_json_consumer","instances","my_consumer_instance","records", sep = "/"),
+ accept("application/vnd.kafka.json.v2+json"),
+ encode="json")
+
+messages2 <- fromJSON(content(messagesJSON,"text"))
+
+apachelog <- rbind(messages$value,messages2$value)
+
+createPlot(apachelog)
# Remove the consumer
DELETE(url = paste(kafka_rest_proxy,"consumers","my_json_consumer","instances","my_consumer_instance", sep = "/"),
# Remove the consumer
DELETE(url = paste(kafka_rest_proxy,"consumers","my_json_consumer","instances","my_consumer_instance", sep = "/"),