Skip to content

Instantly share code, notes, and snippets.

@ngollperrier
Created April 23, 2021 16:44
Show Gist options
  • Save ngollperrier/677c5526010f9c289e3ffbc6b466c5ff to your computer and use it in GitHub Desktop.
Save ngollperrier/677c5526010f9c289e3ffbc6b466c5ff to your computer and use it in GitHub Desktop.
public interface Partitioner<T> {
void configure(Map<String, Object> config);
/**
* Returns string representing the output path for a sinkRecord to be encoded and stored.
*
* @param sinkRecord The record to be stored by the Sink Connector
* @return The path/filename the SinkRecord will be stored into after it is encoded
*/
String encodePartition(SinkRecord sinkRecord);
/**
* Returns string representing the output path for a sinkRecord to be encoded and stored.
*
* @param sinkRecord The record to be stored by the Sink Connector
* @param nowInMillis The current time in ms. Some Partitioners will use this option, but by
* default it is unused.
* @return The path/filename the SinkRecord will be stored into after it is encoded
*/
default String encodePartition(SinkRecord sinkRecord, long nowInMillis) {
return encodePartition(sinkRecord);
}
String generatePartitionedPath(String topic, String encodedPartition);
List<T> partitionFields();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment