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

Support for rd_kafka_produce_batch #29

Closed
cmccarthy1 opened this issue Jun 5, 2020 · 5 comments
Closed

Support for rd_kafka_produce_batch #29

cmccarthy1 opened this issue Jun 5, 2020 · 5 comments
Assignees

Comments

@cmccarthy1
Copy link
Contributor

cmccarthy1 commented Jun 5, 2020

Internal Feature Request

Is your feature request related to a problem? Please describe.
Within the librdkafka C api there appears to be functionality to allow the batched send/receive of data. In many use cases this is preferable to the continuous consumption/sending of data.

Describe the solution you'd like
Provide a logical mechanism for q to expose the use of some of the below librdkafka C functions

  • rd_kafka_produce_batch

Describe alternatives you've considered
There isn't currently an alternative mechanism within the structure of the interface to provide this functionality

Additional resource

@sshanks-kx sshanks-kx self-assigned this Jun 15, 2020
@sshanks-kx
Copy link
Contributor

sshanks-kx added a commit to sshanks-kx/kafka that referenced this issue Jun 16, 2020
@sshanks-kx sshanks-kx changed the title Support for batched send/receive of messages Support for rd_kafka_produce_batch Jun 16, 2020
sshanks-kx added a commit to sshanks-kx/kafka that referenced this issue Jun 16, 2020
@sshanks-kx
Copy link
Contributor

Initial code done, but rd_kafka_produce_batch isn't in older librdkafka packages (build fails on travis cos librdkafka too old).
Find release it appeared to see if it may be possible to add condition to add when build with newer release.

@sshanks-kx
Copy link
Contributor

Added in librdkafka release 0.8.4 https://github.com/edenhill/librdkafka/releases/tag/0.8.4

sshanks-kx added a commit to sshanks-kx/kafka that referenced this issue Jun 16, 2020
@sshanks-kx
Copy link
Contributor

sshanks-kx commented Jun 16, 2020

Looks like batch supported added in 0.8.4 but didn't support RD_KAFKA_MSG_F_PARTITION at this stage …
confluentinc/librdkafka@b8d0b84
Looks like 0.11.4

@sshanks-kx
Copy link
Contributor

Support for batch publish.

Example use:

/ send 2 msgs to any partition for topic, use default key generation
 .kfk.BatchPub[;.kfk.PARTITION_UA;batchMsg;""]each(topic1;topic2);
/ send 2 msgs to partition 1 for topic, use default key generation
 .kfk.BatchPub[;1i;batchMsg;""]each(topic1;topic2);
/ send 2 msgs. First to partition 0 and second to partition 1. Use keys provided for each msg.
.kfk.BatchPub[;(0i;1i);batchMsg;batchKeys]each(topic1;topic2);
* @param x Topic Index (prev created)
 * @param y Partition to use for all message (int) or partition per message (list of ints)
 * @param z Payload for all messages (mixed list containing either bytes or string).
 * @param r Key. Empty string to use auto key for all messages, or key per message (mixed list containing either bytes or string)
 * @returns Integer list with a status for each send message (zero indicates success) 
 *          reference: https://github.com/edenhill/librdkafka/blob/master/src/rdkafka.h (rd_kafka_resp_err_t)

Requires librdkafka be release 0.11.4 and above.
If older, function still exists but returns an error saying its unsupported.

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

No branches or pull requests

2 participants