I am trying to do avro serialization in Ruby. I have written the JSON
schema, however I like to have the serialized data as bytes in Ruby instead
of writing to file.
My code is hanging in somewhere like:
SCHEMA = <<-JSON { "type": "record", "name": "User", "fields" : [ {"name":
"name", "type": "string"}, {"name": "id", "type": "long"}, {"name": "city",
"type": "string"} ] } JSON
schema = Avro::Schema.parse(SCHEMA)
dw = Avro::IO::DatumWriter.new(schema)
buffer = StringIO.new
encoder = Avro::IO::BinaryEncoder.new(buffer)???
I have the values for name, id and city and wondering how to create the
User object and serialize it to a string / byte buffer.
Regards,
Abishek