Skip to content

Instantly share code, notes, and snippets.

View smitty-codes's full-sized avatar

Chris Smith smitty-codes

  • San Diego, CA
View GitHub Profile
smitty-codes / CSharpAvroSchemaless.cs
Last active May 15, 2020 22:11
Apache.Avro schemaless files
// Invoice class generated from a avro protocol file (.avpr) using the nuget package Apache.Avro.Tools
Invoice invoice = new Invoice();
invoice.invoiceno = 123;
// ...(more invoice properties set here)
// set destination
string filePath = String.Format(@"C:\AvroInvoices\{0}.avro", invoice.invoiceNo);
// write avro schemaless file - logic adapted from
SpecificDatumWriter<Invoice> writer = new SpecificDatumWriter<Invoice>(Invoice._SCHEMA);