You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by jinxing <ji...@126.com> on 2015/09/08 12:50:40 UTC

async producer callback not reliable

if i wanna send the message syncronously i can do as below:
future=producer.send(producerRecord, callback);
future.get();


but the throughput decrease dramatically; 


is there a method to send the messages by batch but synchronously ?


Re: async producer callback not reliable

Posted by Mayuresh Gharat <gh...@gmail.com>.
Make sure you have inflight requests set to 1 if you want ordered messages.

Thanks,

Mayuresh

On Tue, Sep 8, 2015 at 5:55 AM, Damian Guy <da...@gmail.com> wrote:

> Can you do:
> producer.send(...)
> ...
> producer.send(...)
> producer.flush()
>
> By the time the flush returns all of your messages should have been sent
>
> On 8 September 2015 at 11:50, jinxing <ji...@126.com> wrote:
>
> > if i wanna send the message syncronously i can do as below:
> > future=producer.send(producerRecord, callback);
> > future.get();
> >
> >
> > but the throughput decrease dramatically;
> >
> >
> > is there a method to send the messages by batch but synchronously ?
> >
> >
>



-- 
-Regards,
Mayuresh R. Gharat
(862) 250-7125

Re: async producer callback not reliable

Posted by Damian Guy <da...@gmail.com>.
Can you do:
producer.send(...)
...
producer.send(...)
producer.flush()

By the time the flush returns all of your messages should have been sent

On 8 September 2015 at 11:50, jinxing <ji...@126.com> wrote:

> if i wanna send the message syncronously i can do as below:
> future=producer.send(producerRecord, callback);
> future.get();
>
>
> but the throughput decrease dramatically;
>
>
> is there a method to send the messages by batch but synchronously ?
>
>