K - key typeV - value typepublic class Printed<K,V> extends Object
KStream.KStream.print(Printed)| Modifier and Type | Field and Description |
|---|---|
protected String | label |
protected KeyValueMapper<? super K,? super V,String> | mapper |
protected OutputStream | outputStream |
protected String | processorName |
| Modifier | Constructor and Description |
|---|---|
protected | Printed(Printed<K,V> printed)Copy constructor. |
| Modifier and Type | Method and Description |
|---|---|
static <K,V> Printed<K,V> | toFile(String filePath)Print the records of a KStream to a file. |
static <K,V> Printed<K,V> | toSysOut()Print the records of a KStream to system out. |
Printed<K,V> | withKeyValueMapper(KeyValueMapper<? super K,? super V,String> mapper)Print the records of a KStream with the provided KeyValueMapper The provided KeyValueMapper's mapped value type must be String. |
Printed<K,V> | withLabel(String label)Print the records of a KStream with the provided label. |
Printed<K,V> | withName(String processorName)Print the records of a KStream with provided processor name. |
protected final OutputStream outputStream
protected String label
protected String processorName
protected KeyValueMapper<? super K,? super V,String> mapper
public static <K,V> Printed<K,V> toFile(String filePath)
KStream to a file.K - key typeV - value typefilePath - path of the filepublic static <K,V> Printed<K,V> toSysOut()
KStream to system out.K - key typeV - value typepublic Printed<K,V> withLabel(String label)
KStream with the provided label.label - label to usepublic Printed<K,V> withKeyValueMapper(KeyValueMapper<? super K,? super V,String> mapper)
KStream with the provided KeyValueMapper The provided KeyValueMapper's mapped value type must be String. The example below shows how to customize output data.
final KeyValueMapper<Integer, String, String> mapper = new KeyValueMapper<Integer, String, String>() {
public String apply(Integer key, String value) {
return String.format("(%d, %s)", key, value);
}
};
Implementors will need to override toString() for keys and values that are not of type String, Integer etc. to get meaningful information.mapper - mapper to use