kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "LEE, Tung-Yu" <tun...@gmail.com>
Subject Sometimes KafkaProducer.send() is blocked without throwing any Exception
Date Tue, 04 Sep 2018 10:03:00 GMT
Hello,

We currently use Kafka 1.0.2 and find that sometimes when using
KafkaProducer.send(), it blocked and didn't throw any exception.



Some code snippets and configuration are as fellows.

Any feedback is welcomed, thank you.



Tung-Yu



##### code snippets ########



Producer<String, String> producer = new KafkaProducer<>(props);

                        try (BufferedReader br = new BufferedReader(new
FileReader(new File(targetFilePath)))) {

                                    String line = br.readLine();

                                    while (line != null) {

                                                ProducerRecord<String,
String> data = new ProducerRecord<String, String>(topicName, line);

                                                producer.send(data); //
sometimes it blocked here

                                                line = br.readLine();

                                    }

                        } catch (Exception e) {

                                    logger.error(e.getMessage(), e);

                        }

producer.close();



##### code snippet ########









#### some producer configuration ######



request.timeout.ms=60000

batch.size=20000

buffer.memory=33554432

retries=3



#### some producer configuration ######

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message