# Class: KafkaProducer

## vertx-kafka-client-js/kafka_producer~ KafkaProducer

#### new KafkaProducer()

Vert.x Kafka producer.

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 34

### Methods

#### close(timeout, completionHandler)

Close the producer

##### Parameters:

Name | Type | Description
--- | --- | ---
`timeout` | number | timeout to wait for closing
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 182

#### drainHandler(handler) → {KafkaProducer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 130

##### Returns:

Type
  KafkaProducer

#### end(kafkaProducerRecord)

##### Parameters:

Name | Type | Description
--- | --- | ---
`kafkaProducerRecord` | KafkaProducerRecord |

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 88

#### exceptionHandler(handler) → {KafkaProducer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function |

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 48

##### Returns:

Type
  KafkaProducer

#### flush(completionHandler) → {KafkaProducer}

Invoking this method makes all buffered records immediately available to write

##### Parameters:

Name | Type | Description
--- | --- | ---
`completionHandler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 167

##### Returns:

current KafkaProducer instance

Type
  KafkaProducer

#### partitionsFor(topic, handler) → {KafkaProducer}

Get the partition metadata for the give topic.

##### Parameters:

Name | Type | Description
--- | --- | ---
`topic` | string | topic partition for which getting partitions info
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 146

##### Returns:

current KafkaProducer instance

Type
  KafkaProducer

#### setWriteQueueMaxSize(i) → {KafkaProducer}

##### Parameters:

Name | Type | Description
--- | --- | ---
`i` | number |

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 103

##### Returns:

Type
  KafkaProducer

#### write(record, handler) → {KafkaProducer}

Asynchronously write a record to a topic

##### Parameters:

Name | Type | Description
--- | --- | ---
`record` | KafkaProducerRecord | record to write
`handler` | function | handler called on operation completed

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 66

##### Returns:

current KafkaWriteStream instance

Type
  KafkaProducer

#### writeQueueFull() → {boolean}

Source:
  - vertx-kafka-client-js/kafka_producer.js, line 117

##### Returns:

Type
  boolean