-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
producev without varargs #2895
Labels
Milestone
Comments
We could make a produce variant that takes an array of RD_KAFKA_V_..s. typedef union {
rd_kafka_topic_t *rkt;
const char *const_str;
char *str;
int i;
int32 i32;
int64 i64;
...
} rd_kafka_v_t ;
rd_kafka_error_t *rd_kafka_produceva(rd_kafka_t *rk, rd_kafka_v_t *vs, size_t v_cnt); What do you think? |
Since C unions are not tagged, I think that you would need to tag them explicitly with something like:
But aside from that quibble, the union-style approach would work fine for my case. |
edenhill
added a commit
that referenced
this issue
May 25, 2020
Please review this PR: #2902 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is not an issue so much as a request for an additional function in the API. Currently, the most general and flexible way to create a single message with headers is
rd_kafka_producev
. This is, for example, the only way to create a message with headers. However, this function uses varargs, which makes it difficult to bind to in most high-level languages. The varargs are used to build ard_kafka_msg_t
, which is then fed intord_kafka_msg_partitioner
. It would make it easier to interface with librdkafka from high-level languages if the user could construct ard_kafka_msg_t
directly and then feed it into someproduce*
variant. I'm not terribly well versed in C library conventions, but I assume that this was not done because adding any field tord_kafka_msg_t
would be a breaking change in the API. I'm not sure if there is a way around that issue or not.The text was updated successfully, but these errors were encountered: