As you know, there are two kinds of ways to send message - synchronous and asynchronous.
When we code with synchronous mode, the code looks the following
producer.send(new ProducerRecord<Long, Event>(topicName, event)).get();
Reading from Kafka document https://kafka.apache.org/10/javadoc/org/apache/kafka/clients/producer/KafkaProducer.html#send-org.apache.kafka.clients.producer.ProducerRecord-, it defines as following:
public java.util.concurrent.Future<RecordMetadata> send(ProducerRecord<K,V> record)
Asynchronously send a record to a topic. Equivalent to send(record, null). See send(ProducerRecord, Callback) for details.
Specified by:
send in interface Producer<K,V>
So, basically send() method return a Futher, then once I use .get() for this future, it becomes synchronous behavour.
My question is, from definition, I don't see an exception definition, how to capture exception under synchronous send()? Seem there doesn't define any exception. Could anybody help clarify for that?