kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zijing Guo <alter...@yahoo.com.INVALID>
Subject Can't send a keyedMessage to brokers with partitioner.class=kafka.producer.DefaultPartitioner
Date Sun, 08 Feb 2015 00:17:45 GMT
Hi,I have a 2 nodes kafka cluster with 2 instances of brokers and zookeepers. And then I create
a topic kafka-test with 2 partitions and replication-factor =2. My producer config is:   
                  {"partitioner.class" "kafka.producer.DefaultPartitioner"     
                "metadata.broker.list" ","   
                  "request.required.acks" "1"}
So for the DefaultPartitoner, it will calculate and hashvalue and divide by the num_partiton
to decide which partition the data it will go, so I create my keyedMessageval key-msg = KeyedMessage("kafka-test","a","test
"a"'s hashValue is 97 and 97 % 2 = 1, so the data should go to partition1. However, the data
did't get send to the brokers (I have a console consumer running that didn't receive any message
from this topic). If I create the key-msg without the key, it works fine
val key-msg = KeyedMessage("kafka-test","test message!")prod.send(key-msg)
Am I using the key wrong or anything?ThanksEdwin

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message