Interface Producer<K,V>
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
- All Known Implementing Classes:
KafkaProducer
,MockProducer
public interface Producer<K,V> extends java.io.Closeable
The interface for theKafkaProducer
- See Also:
KafkaProducer
,MockProducer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
abortTransaction()
void
beginTransaction()
void
close()
default void
close(long timeout, java.util.concurrent.TimeUnit unit)
Deprecated.void
close(java.time.Duration timeout)
void
commitTransaction()
void
flush()
void
initTransactions()
java.util.Map<MetricName,? extends Metric>
metrics()
java.util.List<PartitionInfo>
partitionsFor(java.lang.String topic)
java.util.concurrent.Future<RecordMetadata>
send(ProducerRecord<K,V> record)
java.util.concurrent.Future<RecordMetadata>
send(ProducerRecord<K,V> record, Callback callback)
void
sendOffsetsToTransaction(java.util.Map<TopicPartition,OffsetAndMetadata> offsets, java.lang.String consumerGroupId)
void
sendOffsetsToTransaction(java.util.Map<TopicPartition,OffsetAndMetadata> offsets, ConsumerGroupMetadata groupMetadata)
-
-
-
Method Detail
-
initTransactions
void initTransactions()
-
beginTransaction
void beginTransaction() throws ProducerFencedException
- Throws:
ProducerFencedException
-
sendOffsetsToTransaction
void sendOffsetsToTransaction(java.util.Map<TopicPartition,OffsetAndMetadata> offsets, java.lang.String consumerGroupId) throws ProducerFencedException
- Throws:
ProducerFencedException
-
sendOffsetsToTransaction
void sendOffsetsToTransaction(java.util.Map<TopicPartition,OffsetAndMetadata> offsets, ConsumerGroupMetadata groupMetadata) throws ProducerFencedException
- Throws:
ProducerFencedException
-
commitTransaction
void commitTransaction() throws ProducerFencedException
- Throws:
ProducerFencedException
-
abortTransaction
void abortTransaction() throws ProducerFencedException
- Throws:
ProducerFencedException
-
send
java.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record)
-
send
java.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record, Callback callback)
-
flush
void flush()
-
partitionsFor
java.util.List<PartitionInfo> partitionsFor(java.lang.String topic)
-
metrics
java.util.Map<MetricName,? extends Metric> metrics()
-
close
void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
-
close
@Deprecated default void close(long timeout, java.util.concurrent.TimeUnit unit)
Deprecated.
-
close
void close(java.time.Duration timeout)
-
-