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