简体   繁体   中英

Does Kafka Batching work with blocking send?

Considering that the producer.send() method returns a Future, does doing a future.get() right after it block the batching of records as well?

It blocks to flush the buffer of records and wait for any configured ack of the producer.

KafkaProducer is thread safe, so calling send in a non blocked thread should work, but may result in out-of-order events.

Otherwise, yes, you can call send as many times as needed to batch up data, and not get the first Future.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM