RE: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Haoming Zhang
Hi Joe, I just tried, it works! Now I should to think how to design the partition function. Thanks! Haoming > Date: Thu, 20 Nov 2014 20:44:29 -0500 > Subject: Re: Partition Key Cannot be Send Out by Producer > From: joe.st...@stealth.ly > To: users@kafka.apache.org > > Ye

Re: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Joe Stein
est.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:2722) > at > org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:1043) > at org.scalatest.tools.Runner$.main(Runner.scala:860) > at org.scalatest.tools.Runner.main(Runner.scala) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Nati

RE: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Haoming Zhang
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at scala.tools.eclipse.scalatest.launching.ScalaTestLauncher$.main(ScalaTestLauncher.scala:58) at scala.tools.eclipse.scalatest.launching.ScalaTestLauncher.main(Sc

Re: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Joe Stein
val t2 = new NetworkElement("ANY_USER_2", "ANY_TEXT_2", > BeginningOfEpoch.toSeconds) > val t3 = new NetworkElement("ANY_USER_3", "ANY_TEXT_3", > AnyTimestamp.toSeconds) > > val messages = Seq(t1, t2, t3) > } > } > > BTW, I d

RE: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Haoming Zhang
> > like the following: > > val hardKey = "2" > > val parkey = hardKey.getBytes("UTF8") > > > > But I still get the same exception. I also tried set "UTF8" as "UTF-8", > > but no luck... > > >

Re: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Harsha
t;, > but no luck... > > Regards, > Haoming > > > From: ka...@harsha.io > > To: users@kafka.apache.org > > Subject: Re: Partition Key Cannot be Send Out by Producer > > Date: Thu, 20 Nov 2014 16:43:11 -0800 > > > > Hi Haoming, > >

RE: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Haoming Zhang
quot; as "UTF-8", but no luck... Regards, Haoming > From: ka...@harsha.io > To: users@kafka.apache.org > Subject: Re: Partition Key Cannot be Send Out by Producer > Date: Thu, 20 Nov 2014 16:43:11 -0800 > > Hi Haoming, > Take a look at the code here >

Re: Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Harsha
Hi Haoming, Take a look at the code here https://github.com/stealthly/scala-kafka/blob/master/src/main/scala/KafkaProducer.scala for your partKey it should be string and when you converting it into byte array you can use partKey.getBytes("UTF8") -Harsha On Thu, Nov 20, 2014, a

Partition Key Cannot be Send Out by Producer

2014-11-20 Thread Haoming Zhang
Hi all, I'm a beginner of Kafka, currently I'm stuck by how to send out a KeyedMessage by producer. I would like to design a partition function to route the message based on the key, but the producer cannot send the KeyedMessage and I got this exception: java.lang.ClassCastException: [B cannot b