AvroConvert 3.2.3

There is a newer version of this package available.
See the version list below for details.
dotnet add package AvroConvert --version 3.2.3                
NuGet\Install-Package AvroConvert -Version 3.2.3                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AvroConvert" Version="3.2.3" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AvroConvert --version 3.2.3                
#r "nuget: AvroConvert, 3.2.3"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AvroConvert as a Cake Addin
#addin nuget:?package=AvroConvert&version=3.2.3

// Install AvroConvert as a Cake Tool
#tool nuget:?package=AvroConvert&version=3.2.3                

Docs

Avro format combines readability of JSON and compression of binary data serialization.

Introduction article

Apache Wiki

General information

Documentation

Benefits

The main purpose of the project was to enhance HTTP communication between microservices. Replacing JSON with Avro brought three main benefits:

  • Decreased the communication time between microservices
  • Reduced the network traffic by about 30%
  • Increased communication security - the data was not visible in plain JSON text

Features

AvroConvert Apache.Avro Newtonsoft.Json
Rapid serialization ✔️ ✔️ ✔️
Easy to use ✔️ ✔️
Built-in compression ✔️ ✔️
Low memory allocation ✔️ ✔️ ✔️
Support for C# data structures: Dictionary, List, DateTime... ✔️ ✔️
Support for compression codecs Deflate<br/> Snappy<br/> GZip<br/> Brotli Deflate
Readable schema of data structure ✔️ ✔️ ✔️
Data is encrypted ✔️ ✔️

Full Changelog

Benchmark

Results of BenchmarkDotNet:

Converter Request Time [ms] Allocated Memory [MB] Compressed Size [kB]
Json 672.3 52.23 6044
Avro 384.7 76.58 2623
Json_Gzip 264.1 88.32 514
Avro_Gzip 181.2 75.05 104
Json_Brotli 222.5 86.15 31
Avro_Brotli 193.5 74.75 31

Article describing Avro format specification and benchmark methodology: https://www.c-sharpcorner.com/blogs/avro-rest-api-as-the-evolution-of-json-based-communication-between-mic

Conclusion: <br> Using Avro for communication between your services significantly reduces communication time and network traffic. Additionally choosing encoding (compression algorithm) can improve the results even further.

Code samples

  • Serialization
 byte[] avroObject = AvroConvert.Serialize(object yourObject);

<br/>

  • Deserialization
CustomClass deserializedObject = AvroConvert.Deserialize<CustomClass>(byte[] avroObject);

<br/>

  • Read schema from Avro object
string schemaInJsonFormat = AvroConvert.GetSchema(byte[] avroObject)

<br/>

  • Deserialization of large collection of Avro objects one by one
using (var reader = AvroConvert.OpenDeserializer<CustomClass>(new MemoryStream(avroObject)))
{
    while (reader.HasNext())
    {
        var item = reader.ReadNext();
        // process item
    }
}
  • Generation of C# models from Avro file or schema
  string resultModel = AvroConvert.GenerateModel(_avroBytes);

Full Documentation

Support

If you find my work useful, you can support it 😃

<p align="center"> <a href="https://www.buymeacoffee.com/adrianstrugala" target="_blank"><img src="https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: 31px !important;width: 130px !important;box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;-webkit-box-shadow: 0px 3px 2px 0px rgba(190, 190, 190, 0.5) !important;" ></a> </p>

Nuget - Library containing functionalities, which enable communication between microservices via Http using Avro data format

Nuget - Library containing extensions for Confluent Kafka platform - used together with Kafka Consumer and Producer

License

The project is CC BY-NC-SA 3.0 licensed.
For commercial purposes purchase AvroConvert on website - Xabe.net

Contribution

We want to improve AvroConvert as much as possible. If you have any idea, found next possible feature, optimization opportunity or better way for integration, leave a comment or pull request.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on AvroConvert:

Package Downloads
SolTechnology.Avro.Kafka

Library containing extensions for Confluent Kafka platform

Memphis.Client

Memphis.Client SDK intended to make easy integration of Memphis into .NET projects

SolTechnology.Avro.Http

Library containing functionalities, which enable communication between microservices using Avro data format

OptimoveSdk.Engager.Integration

SDK for Engagers intergration with Optimove

SolTechnology.Core.ApiClient

SolTechnology Core API client library

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on AvroConvert:

Repository Stars
AdrianStrugala/AvroConvert
Rapid Avro serializer for C# .NET
Version Downloads Last updated
3.4.10 1,587 10/21/2024
3.4.9 17,960 9/18/2024
3.4.8 55,209 5/8/2024
3.4.7 2,406 4/26/2024 3.4.7 is deprecated because it has critical bugs.
3.4.6 27,566 3/4/2024
3.4.5 6,177 2/15/2024
3.4.4 13,312 1/16/2024
3.4.3 77,392 12/9/2023
3.4.2 7,046 12/1/2023
3.4.1 12,789 11/11/2023
3.4.0 24,948 9/18/2023
3.3.7 17,034 8/7/2023
3.3.6 34,303 5/29/2023
3.3.5 7,931 5/11/2023
3.3.4 56,643 3/3/2023
3.3.3 580 2/28/2023
3.3.2 21,256 2/6/2023
3.3.1 2,944 1/27/2023
3.3.0 101,059 10/11/2022
3.2.9 76,036 6/22/2022
3.2.8 2,233 6/1/2022
3.2.7 2,081 5/23/2022
3.2.6 822 5/16/2022
3.2.5 61,083 4/13/2022
3.2.4 838 4/10/2022
3.2.3 29,760 10/29/2021
3.2.2 27,518 10/2/2021
3.2.1 1,058 9/29/2021
3.2.0 4,519 9/14/2021
3.1.5 24,498 8/30/2021
3.1.4 5,550 8/12/2021
3.1.3 6,174 8/2/2021
3.1.2 4,368 6/24/2021
3.1.1 1,162 6/14/2021
3.1.0 24,483 5/15/2021
3.0.1 6,332 4/2/2021
3.0.0 24,605 3/26/2021
2.7.1 54,832 2/5/2021
2.7.0 34,595 12/18/2020
2.6.3 3,116 10/25/2020
2.6.2 499 10/23/2020
2.6.1 4,010 7/25/2020
2.6.0 584 7/22/2020
2.5.1 1,436 6/11/2020
2.5.0 16,694 5/15/2020
2.4.1 1,455 4/14/2020
2.4.0 969 3/25/2020
2.3.0 796 3/19/2020
2.2.2 1,102 2/7/2020
2.2.1 585 2/7/2020
2.2.0 680 1/27/2020
2.1.0 572 1/16/2020
2.0.0 567 1/4/2020
1.8.1 854 12/9/2019
1.8.0 3,365 8/30/2019
1.7.0 624 8/22/2019
1.6.0 648 7/22/2019
1.5.1 758 7/14/2019
1.5.0 754 7/11/2019
1.4.0 616 6/17/2019
1.3.0 658 6/4/2019
1.2.0 718 6/3/2019
1.1.0 670 5/28/2019
1.0.1 753 5/21/2019
1.0.0 1,007 4/24/2019
0.8.0 977 5/1/2019
0.7.0 1,059 4/22/2019
0.6.3 957 4/19/2019
0.6.2 974 4/19/2019
0.6.1 946 4/19/2019
0.6.0 956 4/19/2019
0.5.0 1,062 4/18/2019
0.3.0 1,207 4/11/2019
0.2.1 992 4/11/2019
0.2.0 984 4/11/2019
0.1.0 1,082 4/10/2019