Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka >> mail # user >> is it smarter to go with a java class for message serialization/des?


Copy link to this message
-
is it smarter to go with a java class for message serialization/des?
My app is in scala and a quick search on serializing a scala class seems to
have potential issues with different versions of scala (I could be wrong as
I did a quick search).

Is it generally just a better idea to use plain old java classes for kafka
messages?

i.e. I simply use jackson like:

public class User implements Serializable {
...
}

// kakfa
val it = stream.iterator()
while (it.hasNext()) {
  val messageAndTopic = it.next

  val user = mapper.readValue(messageAndTopic.message(), classOf[User])