Goal: I am trying to send messages to kafka from a java cleint.
And it has been a pain..
Let me describe in brief.

1. I have installed kafka on a centos VM.
2. I ran the zookeeper that comes with it, the server , the producer and
the client with all of the default properties files.
    I sent and received messages successfully.
3. I have a telnet connection from my computer to the zookeeper (2181) port
and the kafka server (9092) port at the VM.

Now, I want write java code to send messages to the topic.
I use the example from the quick start at the site:

    Properties props = new Properties();
    props.put("zk.connect", "http://XX.XX.XX.XX:2181";); // XX is the ip
    props.put("serializer.class", "kafka.serializer.StringEncoder");
    producer = new Producer<String, String>(new ProducerConfig(props));

and it fails on the fourth line with the following excetptions :

kafka.common.FailedToSendMessageException: Failed to send messages after 3
tries
and
rg.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to
zookeeper server within timeout: 400


Problems.
1. The exception.
The bad parameters:
In the kafka quick start example I see that it needs only zk.connect,
serializer.class <http://kafka.apache.org/07/quickstart.html> . when I run
it it yells it needs metadata.broker.list in the constructor of the
Producer. Does it? So I feel the ip and port of the kafka server.
and btw - is it zk.connect or zookeeper connect?ZkTimeoutException: Unable
to connect to zookeeper server within timeout: 400

3. maven bad versions

    I go to the site, i see that the latest version is  kafka_2.8.0-0.8.0.
    problem no 1 - I download it using intelij (I think it is maven
central) -
    I get all related jars - only that the kafka jars are empty (contain
only 
manifest<http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.kafka%22%20AND%20a%3A%22kafka_2.8.0%22>
).

    problem no 2 - there are later versions then the one in the site. Are
they official.
    any way, I downloaded org.apache.kafka:kafka_2.10:0.8.0
4. Using wireshark I see three SYN & ACK (triple handshake) and than and
then FYN & ACK
     right after. in the logs of the zookeeper I see the following
      [2014-02-27 01:43:42,127] WARN EndOfStreamException: Unable to read
additional data from client sessionid 0x0, likely client has closed socket

      (org.apache.zookeeper.server.NIOServerCnxn)
      Which means that I close the connection. Why?

Oh, The horror. The horror. <http://en.wikipedia.org/wiki/Heart_of_Darkness>

Reply via email to