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 |
drainHandler(handler) → {KafkaProducer}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
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 |
exceptionHandler(handler) → {KafkaProducer}
Parameters:
| Name | Type | Description |
|---|---|---|
handler |
function |
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 |
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 |
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 |
Returns:
current KafkaWriteStream instance
- Type
- KafkaProducer
setWriteQueueMaxSize(i) → {KafkaProducer}
Parameters:
| Name | Type | Description |
|---|---|---|
i |
number |
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 |
writeQueueFull() → {boolean}
This will return
true if there are more bytes in the write queue than the value set using KafkaProducer#setWriteQueueMaxSize
Returns:
true if write queue is full
- Type
- boolean