Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 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])

 
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB