]> git.vanrenterghem.biz Git - R/project-using-kafka-in-R.git/blob - R/CreateKafkaConsumer.R
cf6edee6dd9066073489cec30476c3a16d5dc78f
[R/project-using-kafka-in-R.git] / R / CreateKafkaConsumer.R
1 CreateKafkaConsumer <- function(kafka.rest.proxy = "http://localhost:8082", consumer, consumer_instance) {
2   response <- POST(url=paste(kafka_rest_proxy, "consumers", consumer, sep="/"),
3                    content_type("application/vnd.kafka.v2+json"),
4                    accept("application/vnd.kafka.v2+json"),
5                    body=paste0('{"name": "',
6                                consumer_instance,
7                                '", "format": "json", "auto.offset.reset": "earliest"}')
8   )
9   consumerDetails <- fromJSON(content(response, "text"))
10   return(consumerDetails)
11 }