question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Manual offset and partition assignment?

See original GitHub issue

This might be a feature request, and it might not be possible.

My use case needs ‘simple consumer’ like behavior. I don’t want Kafka to manage consumer group rebalancing, and I won’t be doing any offset commits. I do want consumers to be able to provide topic, partition, and offset from which they will begin consuming, so that clients can manage their own offsets. When the protocol eventually supports consuming based on event timestamps, I’d like to support that as well.

Is this possible? I see KafkaConsumer.prototype.assign is a function, but I don’t see anything using it, and my attempts to do so leave me in Erroneous state from librdkafka. I think this is either because the offsets aren’t actually passed to librdkafka’s assign, or because of some internal subscribed state that is not being updated.

Is doing something like consumer.assign([ { topic: 'test', partition: 0, offset: 1102583 } ]) possible?

Also, if can I disable auto consumer group rebalancing? I’m looking for a way to override the rebalance_cb, but I don’t see that.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
webmakerstevecommented, Aug 23, 2016

Got too antsy 😛

Currently, the rebalance_cb is on by default and can’t be turned off. However, I’m in the process of writing it so you can opt-out.

However, opting out of the rebalance CB will probably just make librdkafka manage the state internally.

c.f. https://github.com/edenhill/librdkafka/blob/master/src-cpp/rdkafkacpp.h#L541

1reaction
ottomatacommented, Aug 23, 2016

It works! Thank you!

On Tue, Aug 23, 2016 at 1:43 PM, Stephen Parente notifications@github.com wrote:

Can you try the code in this branch to see if it fixes your problem:

https://github.com/Blizzard/node-rdkafka/tree/assignment-fix

Should also now allow offsets to be passed into the object.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Blizzard/node-rdkafka/issues/18#issuecomment-241814465, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjPxnTX8_JYpoFMd9z9XbeeDHYkOoU1ks5qizE-gaJpZM4JrH28 .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kafka - Manually Assign Partition To A Consumer - LogicBig
A topic partition can be assigned to a consumer by calling KafkaConsumer#assign() public void assign(java.util.
Read more >
How to read from a specific offset and partition with the Kafka ...
In this tutorial, learn how to read from a specific offset and partition with the commandline consumer using Confluent, with step-by-step instructions and ......
Read more >
KafkaConsumer (kafka 2.4.0 API)
See Storing Offsets Outside Kafka for more details. It is also possible for the consumer to manually assign specific partitions (similar to the...
Read more >
Kafka consumer with manual assignment to a specific partition ...
For that I manually assign to each partition, shift the offset and poll like the following: val topicPartition = TopicPartition(topic, ...
Read more >
Kafka - When to commit? - Quarkus
In Kafka terminology, we call this: offset commit. ... Retrieved messages belong to partitions assigned to this consumer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found