public class AsyncKafkaProducer extends Object
However doing that cannot be easily done from the onCompletion callback of the asynchronous kafka producer. Hence this small class that
Modifier and Type | Field and Description |
---|---|
org.apache.kafka.clients.producer.Producer<byte[],byte[]> |
byteProducer
the underlying kafka producer
|
Constructor and Description |
---|
AsyncKafkaProducer(org.apache.kafka.clients.producer.Producer<byte[],byte[]> byteProducer) |
Modifier and Type | Method and Description |
---|---|
void |
abruptClose() |
boolean |
closeRequested() |
boolean |
requestClose()
request the closing of this producer.
|
public org.apache.kafka.clients.producer.Producer<byte[],byte[]> byteProducer
public AsyncKafkaProducer(org.apache.kafka.clients.producer.Producer<byte[],byte[]> byteProducer)
byteProducer
- the plain kafka producerpublic boolean requestClose()
You can safely call this from a Kafka onCompletion callback
public boolean closeRequested()
public void abruptClose()
Copyright © 2023. All rights reserved.