]> git.vanrenterghem.biz Git - R/project-using-kafka-in-R.git/blob - R/SubscribeKafkaTopic.R
5e6976b64aa94f049f8766e48a2b427f667ce770
[R/project-using-kafka-in-R.git] / R / SubscribeKafkaTopic.R
1 SubscribeKafkaTopic <- function(consumer.base.uri, topic) {
2   response <- POST(url=paste(consumer.base.uri,
3                              "subscription", sep="/"),
4                    content_type("application/vnd.kafka.v2+json"),
5                    body = paste0('{"topics":["',
6                                  topic,
7                                  '"]}')
8   )
9   if(response$status_code == 204) {
10     return(response)
11   } else stop(response)
12 }