You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Lianet Magrans (Jira)" <ji...@apache.org> on 2026/03/09 15:49:00 UTC
[jira] [Commented] (KAFKA-20275) API to set commit offsets without being subscribed
[ https://issues.apache.org/jira/browse/KAFKA-20275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18064164#comment-18064164 ]
Lianet Magrans commented on KAFKA-20275:
----------------------------------------
Hey [~wdaehn], the consumer.commit API does not require to subscribe first really, it can be used with manual assignment (consumer.assign) as long as the consumer has configured a group.id
There are integration tests showing flows similar to what I understand you want to achieve (assign + commit + other consumers seeing the new committed offset and consuming from it), e.g.
[https://github.com/apache/kafka/blob/4ea29da3ca1776f6870905eed015ef5751e4866c/clients/clients-integration-tests/src/test/java/org/apache/kafka/clients/consumer/PlaintextConsumerAssignTest.java#L247]
Is that the sequence that you're looking for? Let me know, hope it helps!
> API to set commit offsets without being subscribed
> --------------------------------------------------
>
> Key: KAFKA-20275
> URL: https://issues.apache.org/jira/browse/KAFKA-20275
> Project: Kafka
> Issue Type: Improvement
> Components: consumer
> Affects Versions: 4.1.1
> Reporter: Werner Daehn
> Priority: Minor
>
> Imagine you want to reset the consumer offset to something earlier. The last delta load from offset 100-200 was technically successful but you need to run it again.
> So you want to change the offset for topic1/partition0 to 100 again.
> But you cannot, because the only API allowing to change offsets is the consumer api and that requires to subscribe first. Without the subscribe, assign only, you get a `Commit failed: Broker: Unknown member`.
> But subscribe assigns partitions to you instead of you being in control of what partitions you want to change.
>
> Hence the procedure should be:
> * consumer.assign(topicpartitions)
> * consumer.commit(topicpartitions)
> * a rebalance is triggered for all existing consumers to notify them about the commit offset change.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)