Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rd_kafka_produceva() using a vtype array as an alternative to va-args #2902

Merged
merged 2 commits into from
May 27, 2020

Conversation

edenhill
Copy link
Contributor

It is problematic to construct va-arg lists for calling C in some high-level languages that wrap librdkafka, erlang in the case of #2895.
This new method allows constructing an array of structs instead.

@edenhill edenhill added this to the v1.5.0 milestone May 25, 2020
@edenhill edenhill requested review from mhowlett and rnpridgeon May 25, 2020 18:07
@andrewthad
Copy link
Contributor

This looks like exactly what I was hoping for. Thanks. It's probably worth getting feedback from maintainers of librdkafka bindings in other languages. The bindings I'm working on are for Haskell, and I can confirm that this strategy works well for Haskell's foreign function interface and FFI-related tooling.

}

/* Partition the message */
err = rd_kafka_msg_partitioner(rkt, rkm, 1);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

surprised to see this here, probably some unnecessary duplication of stuff, but not a big deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The produceva() code is a direct copy of producev().

vus[2].u.header.val = "test value";
vus[2].u.header.size = -1;

error = rd_kafka_produceva(rk, vus, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test coverage is a bit light on

Copy link
Contributor

@mhowlett mhowlett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fwiw, rd_kafka_produceva is compatible with .net p/invoke.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants