When you say "Blocked" - for how long did the blocking happened? Also, have
you considered "Flushing" for immediate availability?



On Tue, 4 Sep 2018 at 11:03, LEE, Tung-Yu <tun...@gmail.com> wrote:

> 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 ######
>

Reply via email to