This might be handled using GenericData.  You'd specify no reader
schema when you create your GenericDatumReader so the in-memory data
is represented using the same schema it was written with.  Then use
GenericRecord#put & get to access the fields you require.

http://avro.apache.org/docs/current/api/java/org/apache/avro/generic/GenericRecord.html

Might that work?

Doug


On Tue, Feb 25, 2014 at 4:10 PM, Matan Amir <[email protected]> wrote:
> Hi Avro experts :)
>
> I was searching for an answer in the group already and didn’t find something 
> that I recognized as the answer to this so I apologize if i’m asking 
> something that has been answered frequently.
>
> Let’s say I had a Java library that would send out Avro data over the wire.  
> However, the library would not own the Avro schemas nor know what the schemas 
> were in advance.  The library only required that the schemas contain two 
> specific fields that it would then set on the way out - like a string field 
> and a timestamp.
>
> What is the best way to model this for Avro?  In protobufs this is modeled 
> with a base schema and “extensions” which third parties would use to include 
> their specific fields.  Is there a way in Avro to get the same result?
>
> Thanks and much appreciated!
> Matan

Reply via email to