0

I am trying to add "partition.assignment.strategy" to a Rust (rd-kafka) consumer.

rd-kafka uses libkafka (C implementation) directly.

I searched for both rd-kafka documentation and libkafaka documentation, and found nothing.

I attempted two things, both of which are not valid:

.set("partition.assignment.strategy", "org.apache.kafka.clients.consumer.RoundRobinAssignor")
.set("partition.assignment.strategy", "RoundRobinAssignor")

These variables are listed in the Apache docs here.

https://kafka.apache.org/documentation/#consumerconfigs_partition.assignment.strategy

I am not completely sure, but I would assume that either:

  • The Apache docs are more relevant to Java implementations, so the C/Rust rd-kafka implementations differ slightly
  • or that the C implementation simply doesn't implement the full range of options for "partition.assignment.strategy"

It is quite difficult to find relevant documentation, or at least I looked through both Rust code, C code, and multiple documentation pages, and found no answer.

The exact exception encountered is this:

thread 'main' panicked at 'invalid producer config:
 KafkaError (Client creation error: Unsupported partition.assignment.strategy: RoundRobinAssignor)'
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225

1 Answers1

0

The page you linked to describes Apache's Kafka library written in Java. librdkafka is similar, but obviously cannot load arbitrary Java classes for partition assignments.

Checking the librdkafka configuration docs, you should set it to "roundrobin":

partition.assignment.strategy

The name of one or more partition assignment strategies. The elected group leader will use a strategy supported by all members of the group to assign partitions to group members. If there is more than one eligible strategy, preference is determined by the order of this list (strategies earlier in the list have higher priority). Cooperative and non-cooperative (eager) strategies must not be mixed. Available strategies: range, roundrobin, cooperative-sticky.

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85