Last active
December 14, 2016 16:22
-
-
Save edenhill/627f2699aebd3bb1e4346411307e4c44 to your computer and use it in GitHub Desktop.
rd_kafka_producev() var-arg example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*! | |
* Partition (int32_t) | |
*/ | |
#define RD_KAFKA_V_PARTITION(partition) \ | |
_LRK_TYPECHECK(RD_KAFKA_VTYPE_PARTITION, int32_t, partition), \ | |
(int32_t)partition | |
/*! | |
* Message value/payload pointer and length (void *, size_t) | |
*/ | |
#define RD_KAFKA_V_VALUE(VALUE,LEN) \ | |
_LRK_TYPECHECK2(RD_KAFKA_VTYPE_VALUE, void *, VALUE, size_t, LEN), \ | |
(void *)VALUE, (size_t)LEN | |
... | |
err = rd_kafka_producev(rk, | |
RD_KAFKA_V_TOPIC(topic), | |
RD_KAFKA_V_VALUE(buf, sizeof(buf)), | |
RD_KAFKA_V_KEY(key, sizeof(key)), | |
RD_KAFKA_V_TIMESTAMP(my_timestamp.min), | |
RD_KAFKA_V_MSGFLAGS(RD_KAFKA_MSG_F_COPY), | |
RD_KAFKA_V_OPAQUE(&msgcounter), | |
RD_KAFKA_V_END); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment