kafka-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ewen Cheslack-Postava <e...@confluent.io>
Subject Re: New (0.8.2.1) Sync Producer with Batch ?
Date Sat, 01 Aug 2015 20:07:46 GMT
Sunil,

Batching is performed for you automatically. There are a few settings you
can use to tweak it's behavior (e.g. linger.ms and batch.size), but the
defaults are good for common workloads and can achieve very high throughput.

If you want to send some messages and then wait for them to be acknowledged
before continuing, you can use the futures that are returned by
producer.send(). Just send many messages, then wait for all the futures by
calling get() on them.

The code on the trunk branch also has a flush() method which does the same
thing without you having to collect all the futures. However, that wasn't
added until after 0.8.2.1 was released. It'll be available with 0.8.3 and
simplifies this use case a bit.

-Ewen

On Sat, Aug 1, 2015 at 1:40 AM, sunil kalva <sambarcode@gmail.com> wrote:

> Can i configure new producer api with batch, and send data in batches in
> synchronous mode ?
>
> --
> SunilKalva
>



-- 
Thanks,
Ewen

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