Julia wrapper for librdkafka.
Currently this package builds only on Linux and requires git
and make
to
be available in command line.
using Pkg
Pkg.clone("https://github.com/dfdx/RDKafka.jl")
Pkg.build("RDKafka")
Producer:
p = KafkaProducer("localhost:9092")
partition = 0
produce(p, "mytopic", partition, "message key", "message payload")
Consumer:
c = KafkaConsumer("localhost:9092", "my-consumer-group")
parlist = [("mytopic", 0), ("mytopic", 1), ("mytopic", 2)]
subscribe(c, parlist)
timeout_ms = 1000
for i=1:10
msg = poll(String, String, c, timeout_ms)
show(msg)
end