didier-wenzek / ocaml-kafka Goto Github PK
View Code? Open in Web Editor NEWOCaml bindings for Kafka
License: MIT License
OCaml bindings for Kafka
License: MIT License
librdkafka supports broker based balanced consumer groups (see FAQ), would be awesome to have this API wrapped in ocaml-kafka lib.
Hey, I saw this project in r/ocaml and wanted to try it out. A quick opam search
showed that this project isn't yet available there.
I was wondering if you consider this project to be worthy of a 0.1
version and would be happy to have it published on OPAM. I've done some of the initial legwork to create an opam package. To complete that I need a tag created in this repo as explained here which will create a tar.gz file for that version.
After that I can create a PR against OPAM and get this project added there.
Cheers
extern CAMLprim
value ocaml_kafka_consume_job(value caml_kafka_topic, value caml_kafka_partition, value caml_kafka_timeout)
{
struct job_consume* job = (struct job_consume*)lwt_unix_new(struct job_consume);
but there is no corresponding free
afaics?
if (conf_err) {
rd_kafka_conf_destroy(conf);
RAISE(RD_KAFKA_CONF_RES(conf_err), "Failed to configure new kafka consumer (%s)", error_msg);
}
rd_kafka_t *handler = rd_kafka_new(RD_KAFKA_CONSUMER, conf, error_msg, sizeof(error_msg));
if (handler == NULL) {
RAISE(RD_KAFKA_RESP_ERR__FAIL, "Failed to create new kafka consumer (%s)", error_msg);
}
this leaks rd_kafka_conf
when rd_kafka_new
fails
See pull request Build & test code on Travis CI #13
Assert_failure("test/integration/integration.ml", 181, 3)
Hey!
The latest release is from 2020. Can we create a new version (0.6)? Thanks!
I'm unable to compile this on Ubuntu 14.04. I tried posting the error on discord but haven't been able to figure out
#=== ERROR while compiling kafka.0.4 ==========================================#
# context 2.0.7 | linux/x86_64 | ocaml-base-compiler.4.05.0 | https://opam.ocaml.org#c23dfbd9
# path ~/locations-consumer/_opam/.opam-switch/build/kafka.0.4
# command ~/.opam/opam-init/hooks/sandbox.sh build jbuilder build -p kafka -j 1
# exit-code 1
# env-file ~/.opam/log/kafka-25955-d2c37b.env
# output-file ~/.opam/log/kafka-25955-d2c37b.out
### output ###
# ocaml_lwt_kafka.c:112:3: warning: implicit declaration of function ‘rd_kafka_consume_queue’ [-Wimplicit-function-declaration]
# [...]
# ocaml_lwt_kafka.c:112:16: warning: assignment makes pointer from integer without a cast [enabled by default]
# job->message = rd_kafka_consume_queue(job->queue, job->timeout);
# ^
# ocaml_lwt_kafka.c: At top level:
# ocaml_lwt_kafka.c:241:3: error: unknown type name ‘rd_kafka_queue_t’
# rd_kafka_queue_t *queue;
# ^
# ocaml_lwt_kafka.c: In function ‘worker_consume_batch_queue’:
# ocaml_lwt_kafka.c:255:3: warning: implicit declaration of function ‘rd_kafka_consume_batch_queue’ [-Wimplicit-function-declaration]
# job->actual_msg_count = rd_kafka_consume_batch_queue(job->queue, job->timeout, job->messages, job->msg_count);
Thanks!
Are there plans to publish kafka_async? I'm going to have trouble convincing folks to pin an unpublished version of this library
if (Is_block(caml_delivery_callback)) {
caml_callback = Field(caml_delivery_callback, 0);
rd_kafka_conf_set_opaque(conf, (void*) caml_callback);
rd_kafka_conf_set_dr_cb(conf, ocaml_kafka_delivery_callback);
}
this stores OCaml value in the C structure without registering as GC root
I observe memory corruption when trying to run Kafka_lwt.consume_batch on the same topic object but different partitions in two Lwt threads. Is it supposed to work like this?
The partitioner callback set when a topic producer is created is not used when messages are produced with no partition assigned.
Setting a partitioner callback as in:
let partitioner_callback partition_cnt key = Some ((Hashtbl.hash key) mod partition_cnt) in
let topic = Kafka.new_topic ~partitioner_callback producer topic_name options in
Kafka.produce topic ~key msg
we expect that the partitioner_callback
is called for each message produced without a partition.
Actually, the custom callback is never invoked and the partition is assigned using the partitioner set by the partitioner property
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.