Class RecordCollectorImpl
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.RecordCollectorImpl
-
- All Implemented Interfaces:
RecordCollector
public class RecordCollectorImpl extends Object implements RecordCollector
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.kafka.streams.processor.internals.RecordCollector
RecordCollector.Supplier
-
-
Constructor Summary
Constructors Constructor Description RecordCollectorImpl(org.apache.kafka.common.utils.LogContext logContext, TaskId taskId, StreamsProducer streamsProducer, ProductionExceptionHandler productionExceptionHandler, StreamsMetricsImpl streamsMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
closeClean()
Clean close the internalProducer
.void
closeDirty()
Dirty close the internalProducer
.void
flush()
Flush the internalProducer
.void
initialize()
Initialize the internalProducer
; note this function should be made idempotentMap<TopicPartition,Long>
offsets()
The last acked offsets from the internalProducer
.<K,V>
voidsend(String topic, K key, V value, Headers headers, Integer partition, Long timestamp, Serializer<K> keySerializer, Serializer<V> valueSerializer)
<K,V>
voidsend(String topic, K key, V value, Headers headers, Long timestamp, Serializer<K> keySerializer, Serializer<V> valueSerializer, StreamPartitioner<? super K,? super V> partitioner)
-
-
-
Constructor Detail
-
RecordCollectorImpl
public RecordCollectorImpl(org.apache.kafka.common.utils.LogContext logContext, TaskId taskId, StreamsProducer streamsProducer, ProductionExceptionHandler productionExceptionHandler, StreamsMetricsImpl streamsMetrics)
- Throws:
StreamsException
- fatal error that should cause the thread to die (from producer.initTxn)
-
-
Method Detail
-
initialize
public void initialize()
Description copied from interface:RecordCollector
Initialize the internalProducer
; note this function should be made idempotent- Specified by:
initialize
in interfaceRecordCollector
-
send
public <K,V> void send(String topic, K key, V value, Headers headers, Long timestamp, Serializer<K> keySerializer, Serializer<V> valueSerializer, StreamPartitioner<? super K,? super V> partitioner)
- Specified by:
send
in interfaceRecordCollector
- Throws:
StreamsException
- fatal error that should cause the thread to dieTaskMigratedException
- recoverable error that would cause the task to be removed
-
send
public <K,V> void send(String topic, K key, V value, Headers headers, Integer partition, Long timestamp, Serializer<K> keySerializer, Serializer<V> valueSerializer)
- Specified by:
send
in interfaceRecordCollector
-
flush
public void flush()
Description copied from interface:RecordCollector
Flush the internalProducer
.- Specified by:
flush
in interfaceRecordCollector
- Throws:
StreamsException
- fatal error that should cause the thread to dieTaskMigratedException
- recoverable error that would cause the task to be removed
-
closeClean
public void closeClean()
Description copied from interface:RecordCollector
Clean close the internalProducer
.- Specified by:
closeClean
in interfaceRecordCollector
- Throws:
StreamsException
- fatal error that should cause the thread to dieTaskMigratedException
- recoverable error that would cause the task to be removed
-
closeDirty
public void closeDirty()
Description copied from interface:RecordCollector
Dirty close the internalProducer
.- Specified by:
closeDirty
in interfaceRecordCollector
- Throws:
StreamsException
- fatal error that should cause the thread to dieTaskMigratedException
- recoverable error that would cause the task to be removed
-
offsets
public Map<TopicPartition,Long> offsets()
Description copied from interface:RecordCollector
The last acked offsets from the internalProducer
.- Specified by:
offsets
in interfaceRecordCollector
- Returns:
- an immutable map from TopicPartition to offset
-
-