Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

TopicPartition comes from org.apache.kafka.common package

RecordsToDelete, DeleteRecordsOptions and DeleteRecordsResult are defined as follow. 

Code Block
languagejava
/**
 * Options for {@link AdminClient#deleteRecords(Map, DeleteRecordsOptions)}.
 */
public class DeleteRecordsOptions extends AbstractOptions<DeleteRecordsOptions> {

}
 
/**
 * Describe records as target to delete in a call to delete{@link AdminClient#deleteRecords(Map)}
 */
public class RecordsToDelete {
	private long offset;
	
	/** 
	 * Delete all the records before the given {@code offset}
	 *
	 * @param offset    the offset before which all records will be deleted
	 */
	public static RecordsToDelete beforeOffset(long offset) { ... }
}

/**
 * The result of the {@link AdminClient#deleteRecords(Map)} call.
 */ 
public class DeleteRecordsResult {
    // package access constructor
    Map<TopicPartition, KafkaFuture<Long>> values() { ... }
    KafkaFuture<Long> all() { ... }
}

In the DeleteRecordsResult, the Long value accessed by values() and all() method specifies the low watermark as described in the KIP-107.

 The deleteRecords() will have the same authorization setting as deleteTopic(). Its operation type is be DELETE and its resource type is TOPIC.

...