avro-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From felix gao <gre1...@gmail.com>
Subject Avro Serialization help
Date Thu, 31 Mar 2011 01:44:57 GMT
Hi all,

I'd like to use avro as the mechanism that serialize and de-serialize data
between client and server.   Since my google-jitsu is very weak, I can't
find any tutorials online teach me how to do this.  Basically,  I have an
object that is Map<String, List<Map<String, Object>>> in my server that
needs to be transfered to the client in Binary format and I am not sure how
to should I code that so the data will be written as bytes to be transferred
by http protocol and once the client receives it then de-serialize into java
objects again.

below is an example schema that I generated which I think maps to my java
object definition.

{
  "namespace" : "test.gen.avro",
  "types" : [ {
    "type" : "record",
    "name" : "KVPair",
    "fields" : [ {
      "name" : "name",
      "type" : "string"
    }, {
      "name" : "val",
      "type" : "int"
    } ]
  }, {
    "type" : "record",
    "name" : "Result",
    "fields" : [ {
      "name" : "res",
      "type" : {
        "type" : "map",
        "values" : {
          "type" : "array",
          "items" : {
            "type" : "map",
            "values" : "KVPair"
          }
        }
      }
    } ]
  } ]
}


thanks in advance.

Felix

Mime
View raw message