Yes, it helps a lot. When I run in async mode my producer stays up and healthy even if zookeeper and/or Kafka brokers are down.
Thanks, C. Helck -----Original Message----- From: Dragos Manolescu [mailto:dmanole...@whitepages.com] Sent: Wednesday, April 30, 2014 5:50 PM To: users@kafka.apache.org Subject: Re: Need example of robust Producer Does this help: https://github.com/stealthly/scala-kafka/blob/master/src/main/scala/KafkaPr oducer.scala -Dragos On 4/30/14, 5:29 AM, "Chris Helck" <chris.he...@ebs.com> wrote: >I am new to Kafka. I'd like to see example code that uses a Producer and >handles connectivity errors to Kafka brokers and/or ZooKeeper. > >I have seen some code that creates and tears down a Producer for each >message that is sent, but this doesn't seem right to me. The same example >code, queries ZooKeeper to ask if Kafka is running before creating the >Producer. I don't know why this is done. What if ZooKeeper isn't up? Why >not just try to make the connection and handle any errors that occur? > >A nice, well written example, would clear up a lot of my questions. > >Thanks, >C. Helck > >********************************************************************** >This communication and all information contained in or attached to it >(including, but not limited to market prices/levels and market >commentary) (the ³Information²) is for informational purposes only, is >confidential, may be legally privileged and is the intellectual property >of one of the companies of ICAP plc group (³ICAP²) or third parties. The >Information is not, and should not be construed as, an offer, bid, >recommendation or solicitation in relation to any financial instrument or >investment or to participate in any particular trading strategy. The >Information is not to be relied upon and is not warranted, including, but >not limited, as to completeness, timeliness or accuracy and is subject to >change without notice. All representations and warranties are expressly >disclaimed. Access to the Information by anyone other than the intended >recipient is unauthorised and any disclosure, copying or redistribution >is prohibited. If you receive this message in error, please immediately >delete all copies of it and notify the sender. For further information, >please see ebs.com. >********************************************************************** >-------------------------------------------------------------------------- >------------- > This email has been scanned for email related threats and delivered >safely by Mimecast. > For more information please visit http://www.mimecast.com >-------------------------------------------------------------------------- >------------- > > --------------------------------------------------------------------------------------- This email has been scanned for email related threats and delivered safely by Mimecast. For more information please visit http://www.mimecast.com ---------------------------------------------------------------------------------------