Interface Producer<K,V>
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
KafkaProducer
,MockProducer
public interface Producer<K,V> extends Closeable
The interface for the
KafkaProducer
- See Also:
KafkaProducer
,MockProducer
-
Method Summary
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 Details
-
initTransactions
void initTransactions() -
beginTransaction
- Throws:
ProducerFencedException
-
sendOffsetsToTransaction
@Deprecated void sendOffsetsToTransaction(Map<TopicPartition,OffsetAndMetadata> offsets, String consumerGroupId) throws ProducerFencedExceptionDeprecated.- Throws:
ProducerFencedException
-
sendOffsetsToTransaction
void sendOffsetsToTransaction(Map<TopicPartition,OffsetAndMetadata> offsets, ConsumerGroupMetadata groupMetadata) throws ProducerFencedException- Throws:
ProducerFencedException
-
commitTransaction
- Throws:
ProducerFencedException
-
abortTransaction
- Throws:
ProducerFencedException
-
send
-
send
-
flush
void flush() -
partitionsFor
-
metrics
Map<MetricName,? extends Metric> metrics() -
close
void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
close
-