Skip to content

How to use $key for internal Kafka partitioning logic on producer #26

@mrdvt92

Description

@mrdvt92

I'm not a pro at C but it appears that we can pass a -1 as the partition and then the $key will go through the crc32 logic for automatic partitioning. Is that correct?

If so, can that be documented. Also supporting undef() would make for a better perl-ish API.

$err = $topic->produce($partition, $msgflags, $payload, $key);
$err = $topic->produce(-1, $msgflags, $payload, $key); #auto partition based on $key
$err = $topic->produce(undef(), $msgflags, $payload, $key); #future auto partition based on $key

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions