public class KafkaItemWriter<K,T> extends KeyValueItemWriter<K,T>
An ItemWriter implementation for Apache Kafka using a
KafkaTemplate with default topic configured.
| Modifier and Type | Field and Description |
|---|---|
protected org.springframework.kafka.core.KafkaTemplate<K,T> |
kafkaTemplate |
delete, itemKeyMapper| Constructor and Description |
|---|
KafkaItemWriter() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
flush()
Flush items to the key/value store.
|
protected void |
init()
afterPropertiesSet() hook
|
void |
setKafkaTemplate(org.springframework.kafka.core.KafkaTemplate<K,T> kafkaTemplate)
Set the
KafkaTemplate to use. |
void |
setTimeout(long timeout)
The time limit to wait when flushing items to Kafka.
|
protected void |
writeKeyValue(K key,
T value)
Subclasses implement this method to write each item to key value store
|
afterPropertiesSet, setDelete, setItemKeyMapper, writeprotected void writeKeyValue(K key, T value)
KeyValueItemWriterwriteKeyValue in class KeyValueItemWriter<K,T>key - the keyvalue - the itemprotected void flush()
throws java.lang.Exception
KeyValueItemWriterflush in class KeyValueItemWriter<K,T>java.lang.Exception - if unable to flush itemsprotected void init()
KeyValueItemWriterinit in class KeyValueItemWriter<K,T>public void setKafkaTemplate(org.springframework.kafka.core.KafkaTemplate<K,T> kafkaTemplate)
KafkaTemplate to use.kafkaTemplate - to usepublic void setTimeout(long timeout)
timeout - milliseconds to wait, defaults to -1 (no timeout).