You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have some options how to define an interface for the producer and consumer objects
use the raw rcpp modules
enhance the rcpp modules with some usability functions like print, value, etc. "functional style"
use an oop approach and hide the consumer and producer objects within the class
I prefer the last approach and like the idea to use R6 classes. Even though this is not the most R idiomatic it helps us to provide a clean interface and separate between rcpp and R functionality. Example of usage:
config<-list("bootstrap.servers"="my.kafka.server")
consumer<-Consumer$new(config)
consumer$subscribe("topic")
msg<-consumer$poll(timeout=1)
rm(consumer) # calls finalizer of R6 class (unsubscribe, close connection)
For the message we also need to think about the interface as it not only contains the result but possible also keys, error codes, error messages. I would think of messages as list objects of class kafka_message
We have some options how to define an interface for the producer and consumer objects
I prefer the last approach and like the idea to use R6 classes. Even though this is not the most R idiomatic it helps us to provide a clean interface and separate between rcpp and R functionality. Example of usage:
For the message we also need to think about the interface as it not only contains the result but possible also keys, error codes, error messages. I would think of messages as
list
objects of classkafka_message
Producing messages would work the same. I would give the user the possibility to both publish using key and value or using a message object
@wahani happy to hear your thoughts on this
The text was updated successfully, but these errors were encountered: