You can register a callback for each sent record to learn about
successful write or fail:

> producer.send(record, callback);

For replication, you don't need to send twice. If the replication factor
is configured broker side, the broker take care of replication
automatically.

You can also configure when you want to be informed about successful
write: before or after replication.

This blog post should help:
https://www.confluent.io/blog/hands-free-kafka-replication-a-lesson-in-operational-simplicity/



-Matthias

On 5/20/18 11:00 AM, Pavel Sapozhnikov wrote:
> Hello
> 
> What are the best practices when it comes to publishing a message into
> kafka. When sending a message into Kafka is it possible to know if that
> message has successfully been published? If not, what is the best practice
> to know when messages are not getting published?
> 
> Second question.
> 
> If I have two kafka brokers and very simplistic one kafka topic replicated
> on both. Do I need to send to both brokers. What are the best practices for
> that.
> 

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to