Producer.send() by itself will not throw anything.

You need to either wait on the future:
producer.send().get()

Or to use it with a callback that logs the error.

On Tue, Jan 26, 2016 at 8:50 AM, Joe San <codeintheo...@gmail.com> wrote:

> Is this strange or wierd? I had no Kafka or Zookeeper running on my local
> machine and I was expecting an exception, but for some strange reason, I do
> not see any errors:
>
> try {
>   logger.info(s"kafka producer obtained is ${producer}")
>   producer.send(
>     new ProducerRecord[String, String](producerConfig.topic, jsonMessage)
>   )
> } catch {
>   case x: Throwable => logger.error(s"shit happened *******
> ${x.getMessage}")
> }
>

Reply via email to