vertx / io.vertx.kafka.client.producer / KafkaProducer

# KafkaProducer

`interface KafkaProducer<K : Any, V : Any> : WriteStream<KafkaProducerRecord<K, V>>`

Vert.x Kafka producer.

The `#write(Object)` provides global control over writing a record.

### Functions

asStream | `abstract fun asStream(): KafkaWriteStream<K, V>`
close | `abstract fun close(): Unit` `abstract fun close(completionHandler: Handler<AsyncResult<Void>>): Unit` `abstract fun close(timeout: Long, completionHandler: Handler<AsyncResult<Void>>): Unit` Close the producer
create | `open static fun <K : Any, V : Any> create(vertx: Vertx, producer: Producer<K, V>): KafkaProducer<K, V>` Create a new KafkaProducer instance from a native Producer. `open static fun <K : Any, V : Any> create(vertx: Vertx, config: MutableMap<String, String>): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> create(vertx: Vertx, config: MutableMap<String, String>, keyType: Class<K>, valueType: Class<V>): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> create(vertx: Vertx, config: Properties): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> create(vertx: Vertx, config: Properties, keyType: Class<K>, valueType: Class<V>): KafkaProducer<K, V>` Create a new KafkaProducer instance
createShared | `open static fun <K : Any, V : Any> createShared(vertx: Vertx, name: String, config: Properties): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> createShared(vertx: Vertx, name: String, config: MutableMap<String, String>): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> createShared(vertx: Vertx, name: String, config: MutableMap<String, String>, keyType: Class<K>, valueType: Class<V>): KafkaProducer<K, V>` `open static fun <K : Any, V : Any> createShared(vertx: Vertx, name: String, config: Properties, keyType: Class<K>, valueType: Class<V>): KafkaProducer<K, V>` Get or create a KafkaProducer instance which shares its stream with any other KafkaProducer created with the same `name`
drainHandler | `abstract fun drainHandler(handler: Handler<Void>): KafkaProducer<K, V>`
end | `abstract fun end(): Unit` `abstract fun end(kafkaProducerRecord: KafkaProducerRecord<K, V>): Unit`
exceptionHandler | `abstract fun exceptionHandler(handler: Handler<Throwable>): KafkaProducer<K, V>`
flush | `abstract fun flush(completionHandler: Handler<Void>): KafkaProducer<K, V>` Invoking this method makes all buffered records immediately available to write
partitionsFor | `abstract fun partitionsFor(topic: String, handler: Handler<AsyncResult<MutableList<PartitionInfo>>>): KafkaProducer<K, V>` Get the partition metadata for the give topic.
setWriteQueueMaxSize | `abstract fun setWriteQueueMaxSize(i: Int): KafkaProducer<K, V>`
unwrap | `abstract fun unwrap(): Producer<K, V>`
write | `abstract fun write(kafkaProducerRecord: KafkaProducerRecord<K, V>): KafkaProducer<K, V>``abstract fun write(record: KafkaProducerRecord<K, V>, handler: Handler<AsyncResult<RecordMetadata>>): KafkaProducer<K, V>` Asynchronously write a record to a topic
writeQueueFull | `abstract fun writeQueueFull(): Boolean`