Skip to content

mjermann/fRanz

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fRranz: An R Kafka Client

THIS PROJECT IS STILL ALPHA CURRENTLY -- Check back often!!

What is fRanz

fRanz is an open source R kafka client that allows users to read and write messages from kafka. It leverages the stability and performance of librdkafka and implements ididiomatic R workflows ontop of it.

Example of sending and reading a message

library(fRanz)

BROKER_HOST <- 'localhost'
BROKER_PORT <- 9092
TOPIC_NAME <- 'myTestTopic'

# KafkaBroker
broker <- KafkaBroker$new(host=BROKER_HOST, port=BROKER_PORT)

# KafkaProducer
producer <- KafkaProducer$new(brokers = list(broker))
producer$produce(topic = TOPIC_NAME,
                 key = "myKey",
                 value = "My First Message")
# Number of messages successfuly sent is returned
# [1] 1 


#KafkaConsumer
consumer <- KafkaConsumer$new(brokers = list(broker), groupId = "test", extraOptions=list(`auto.offset.reset`="earliest"))
consumer$subscribe(topics = c(TOPIC_NAME))
result <- consumer$consume(topic=TOPIC_NAME)

result
# Consumed messages are returned in a list(list(key,val)) format
# [[1]]
# [[1]]$key
# [1] "myKey"
#
# [[1]]$payload
# [1] "My First Message" 

About

R client for Apache Kafka

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 45.6%
  • R 41.8%
  • Makefile 11.5%
  • C 1.1%