public interface Producer<K,V>
extends java.io.Closeable
KafkaProducerKafkaProducer,
MockProducer| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close this producer
|
void |
close(long timeout,
java.util.concurrent.TimeUnit unit)
Tries to close the producer cleanly within the specified timeout.
|
void |
flush()
Flush any accumulated records from the producer.
|
java.util.Map<MetricName,? extends Metric> |
metrics()
Return a map of metrics maintained by the producer
|
java.util.List<PartitionInfo> |
partitionsFor(java.lang.String topic)
Get a list of partitions for the given topic for custom partition assignment.
|
java.util.concurrent.Future<RecordMetadata> |
send(ProducerRecord<K,V> record)
Send the given record asynchronously and return a future which will eventually contain the response information.
|
java.util.concurrent.Future<RecordMetadata> |
send(ProducerRecord<K,V> record,
Callback callback)
Send a record and invoke the given callback when the record has been acknowledged by the server
|
java.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record)
record - The record to sendjava.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record, Callback callback)
void flush()
java.util.List<PartitionInfo> partitionsFor(java.lang.String topic)
java.util.Map<MetricName,? extends Metric> metrics()
void close()
close in interface java.lang.AutoCloseableclose in interface java.io.Closeablevoid close(long timeout,
java.util.concurrent.TimeUnit unit)