Description
The current version of the offset commit API in the new consumer is
void commit(offsets, commit type)
where the commit type is either sync or async. This means you need to use sync if you ever want confirmation that the commit succeeded. Some applications will want to use asynchronous offset commit, but be able to tell when the commit completes.
This is basically the same problem that had to be fixed going from old consumer -> new consumer and I'd suggest the same fix using a callback + future combination. The new API would be
Future<Void> commit(Map<TopicPartition, Long> offsets, ConsumerCommitCallback callback);
where ConsumerCommitCallback contains a single method:
public void onCompletion(Exception exception);
We can provide shorthand variants of commit() for eliding the different arguments.