We can implement the interface and pass an instance of the implementing class at the time of invoking the subscribe() call of the consumer object. The code widget below demonstrates an example of the onPartitionsRevoked method in use to commit offsets just before a consumer loses ownership of a partition.