Class: KafkaProducer

vertx-kafka-client-js/kafka_producer~ KafkaProducer

new KafkaProducer()

Vert.x Kafka producer.

Source:

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:

drainHandler(handler) → {KafkaProducer}

Parameters:
Name Type Description
handler function
Source:
Returns:
Type
KafkaProducer

end(data, handler)

Same as but with an handler called when the operation completes
Parameters:
Name Type Description
data KafkaProducerRecord
handler function
Source:

exceptionHandler(handler) → {KafkaProducer}

Parameters:
Name Type Description
handler function
Source:
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:
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:
Returns:
current KafkaProducer instance
Type
KafkaProducer

send(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:
Returns:
current KafkaWriteStream instance
Type
KafkaProducer

setWriteQueueMaxSize(i) → {KafkaProducer}

Parameters:
Name Type Description
i number
Source:
Returns:
Type
KafkaProducer

write(data, handler)

Same as but with an handler called when the operation completes
Parameters:
Name Type Description
data KafkaProducerRecord
handler function
Source:

writeQueueFull() → {boolean}

This will return true if there are more bytes in the write queue than the value set using KafkaProducer#setWriteQueueMaxSize
Source:
Returns:
true if write queue is full
Type
boolean