[ 
https://issues.apache.org/jira/browse/KAFKA-19333?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17954099#comment-17954099
 ] 

Lianet Magrans commented on KAFKA-19333:
----------------------------------------

Hey [~lansg]! Just to add context from the Consumer point of view, it's 
intentional that the onPartitionsRevoked is only called when there are some 
partitions that the consumer needs to give up, mainly to respect the contract 
and behaviour of the ConsumerRebalanceListener, which defines the consumer 
callbacks (ex. this for revocation/lost 
https://github.com/apache/kafka/blob/48a52701b9cd45c4854f910990a85be7d73e22f5/clients/src/main/java/org/apache/kafka/clients/consumer/ConsumerRebalanceListener.java#L123
 )

To complete the story on the Consumer side, onPartitionsAssigned is called 
whenever a rebalance completes (even if no new partitions are added).  The 
consumer behaves consistently like this for both rebalance protocols (Classic 
and Consumer).

That being said, on Streams we use another interface for the callbacks, 
StreamsRebalanceListener, so even though I don't have all the details of the 
Streams side (yet), first thought is that we don't strictly need to align these 
2 interfaces if it make senses for KS to use the callbacks differently. (We do 
need to align all consumer implementations that use the 
ConsumerRebalanceCallback, that's what was done for the Classic and Async 
Consumer).

Hope it helps! 



> Inconsistent behavior between `ConsumerMembershipManager` and 
> `StreamsMembershipManager` on `onAllTasksLost` execution
> ----------------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-19333
>                 URL: https://issues.apache.org/jira/browse/KAFKA-19333
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Nick Guo
>            Assignee: Nick Guo
>            Priority: Minor
>
> `ConsumerMembershipManager` does not create an event to run a callback if 
> there is nothing to revoke,but `StreamsMembershipManager` does.
> related discussion and pr:
> discussion:[https://github.com/apache/kafka/pull/18551/files#r2106243432]
> pr: https://github.com/apache/kafka/pull/19779



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to