In 0.9.0, close() has a timeout parameter that allows specifying how long to wait for the in-flight messages to complete (definition of complete depends on value of "acks" parameter).
On Wed, Nov 25, 2015 at 3:58 AM, Muqtafi Akhmad <muqt...@traveloka.com> wrote: > Hello guys, > > I am using KafkaProducer (org.apache.kafka.clients.producer.KafkaProducer) > to send messages to Kafka broker. I set BUFFER_MEMORY_CONFIG to some MBs. > If there is a case where we need to shutdown kafka producer when there are > messages in producer's buffer, is there any way to flush these messages to > kafka to prevent event loss? will be calling the close() method do the > trick? > > Thank you, > > -- > Muqtafi Akhmad > Software Engineer > Traveloka >