kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ranjit Kumar <ranjit...@gmail.com>
Subject Re: multiple threads calling kafka producer
Date Fri, 17 Nov 2017 18:23:54 GMT
Hi Manna,

If needed i will close, it's sample one i mentioned, I am thinking of 2
options like
1) keep pool of threads which will receive the data and send continuously
using producer
2) when ever sending create a thread ,send data and close the thread (may
be one point of time 300 threads also will create)


Regards,
Ranjit

On Fri, Nov 17, 2017 at 11:47 PM, M. Manna <manmedia@gmail.com> wrote:

> Are you planning to close these at any point? I'm not seeung any close()
> calls.
>
> On 17 Nov 2017 6:09 pm, "Ranjit Kumar" <ranjitkum@gmail.com> wrote:
>
> Hi All,
>
> I am writing java program with thread pool may be  100 threads  and all
> threads will have kafka producers
> (org.apache.kafka.clients.producer.ProducerRecord) for the same topic,
> will
> their be any problem ?
>
>        thread-1
>         ProducerRecord<String, String> data = new ProducerRecord<>(topic,
> msg); // same topic
>         stringProducer.send(data);
>
>        thread-2
>         ProducerRecord<String, String> data = new ProducerRecord<>(topic,
> msg); // same topic
>         stringProducer.send(data);
>
>        thread-3
>         ProducerRecord<String, String> data = new ProducerRecord<>(topic,
> msg); // same topic
>         stringProducer.send(data);
>
> Regards,
> Ranjit
>

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