AvroConvert 3.3.7
See the version list below for details.
dotnet add package AvroConvert --version 3.3.7
NuGet\Install-Package AvroConvert -Version 3.3.7
<PackageReference Include="AvroConvert" Version="3.3.7" />
paket add AvroConvert --version 3.3.7
#r "nuget: AvroConvert, 3.3.7"
// Install AvroConvert as a Cake Addin #addin nuget:?package=AvroConvert&version=3.3.7 // Install AvroConvert as a Cake Tool #tool nuget:?package=AvroConvert&version=3.3.7
<p align="center"> <img alt="SolTechnology-logo" src="./docs/logo.png" width="200"> </p>
<h2 align="center"> AvroConvert </h2>
<p align="center"> <a> Rapid Avro serializer for C# .NET </a> </p>
<p align="center"> <a href="https://www.nuget.org/packages/AvroConvert"><img src="https://img.shields.io/badge/Nuget-v3.3.7-blue?logo=nuget"></a> <a href="https://avroconvertonline.azurewebsites.net/"><img src="https://img.shields.io/badge/Downloads-440k-blue?logo=github"></a> <a href="https://github.com/AdrianStrugala/AvroConvert/actions/workflows/build&test.yml"><img src="https://github.com/AdrianStrugala/AvroConvert/actions/workflows/build&test.yml/badge.svg"></a>
</p>
Docs
Avro format combines readability of JSON and data compression of binary serialization.
Apache Avro format documentation
First steps with Avro in the .NET article
Benchmark and Avro API article
Benefits
Introducing Avro to the projects brings three main benefits:
- Reduction of data size and storage cost
- Decrease of the communication time and the network traffic between microservices
- Increased security - the data is not visible in plain text format
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 encryption | ✔️ | ✔️ | ❌ |
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 data size 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(avroObject);
- Conversion of Avro to JSON directly
var resultJson = AvroConvert.Avro2Json(avroObject);
Related Work
AvroConvertOnline - online Avro Schema to C# model converter
- Library containing functionalities, which enable communication between microservices via Http using Avro data format
- Library containing components needed for Confluent Kafka integration
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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. |
-
.NETStandard 2.0
- BrotliSharpLib (>= 0.3.3)
- FastMember (>= 1.5.0)
- IronSnappy (>= 1.3.1)
- Microsoft.CSharp (>= 4.7.0)
- Newtonsoft.Json (>= 13.0.3)
- Portable.System.DateTimeOnly (>= 6.0.2)
-
net6.0
- BrotliSharpLib (>= 0.3.3)
- FastMember (>= 1.5.0)
- IronSnappy (>= 1.3.1)
- Newtonsoft.Json (>= 13.0.3)
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 | 9,141 | 10/21/2024 | |
3.4.9 | 33,390 | 9/18/2024 | |
3.4.8 | 70,373 | 5/8/2024 | |
3.4.7 | 2,816 | 4/26/2024 | |
3.4.6 | 30,155 | 3/4/2024 | |
3.4.5 | 7,383 | 2/15/2024 | |
3.4.4 | 15,721 | 1/16/2024 | |
3.4.3 | 80,812 | 12/9/2023 | |
3.4.2 | 8,377 | 12/1/2023 | |
3.4.1 | 13,271 | 11/11/2023 | |
3.4.0 | 25,921 | 9/18/2023 | |
3.3.7 | 18,232 | 8/7/2023 | |
3.3.6 | 35,993 | 5/29/2023 | |
3.3.5 | 8,039 | 5/11/2023 | |
3.3.4 | 60,222 | 3/3/2023 | |
3.3.3 | 591 | 2/28/2023 | |
3.3.2 | 21,344 | 2/6/2023 | |
3.3.1 | 2,968 | 1/27/2023 | |
3.3.0 | 105,705 | 10/11/2022 | |
3.2.9 | 76,289 | 6/22/2022 | |
3.2.8 | 2,253 | 6/1/2022 | |
3.2.7 | 2,241 | 5/23/2022 | |
3.2.6 | 839 | 5/16/2022 | |
3.2.5 | 62,249 | 4/13/2022 | |
3.2.4 | 849 | 4/10/2022 | |
3.2.3 | 29,928 | 10/29/2021 | |
3.2.2 | 28,042 | 10/2/2021 | |
3.2.1 | 1,081 | 9/29/2021 | |
3.2.0 | 4,784 | 9/14/2021 | |
3.1.5 | 24,701 | 8/30/2021 | |
3.1.4 | 5,623 | 8/12/2021 | |
3.1.3 | 6,774 | 8/2/2021 | |
3.1.2 | 4,384 | 6/24/2021 | |
3.1.1 | 1,173 | 6/14/2021 | |
3.1.0 | 25,405 | 5/15/2021 | |
3.0.1 | 6,431 | 4/2/2021 | |
3.0.0 | 24,646 | 3/26/2021 | |
2.7.1 | 55,003 | 2/5/2021 | |
2.7.0 | 34,623 | 12/18/2020 | |
2.6.3 | 3,127 | 10/25/2020 | |
2.6.2 | 510 | 10/23/2020 | |
2.6.1 | 4,125 | 7/25/2020 | |
2.6.0 | 595 | 7/22/2020 | |
2.5.1 | 1,498 | 6/11/2020 | |
2.5.0 | 17,041 | 5/15/2020 | |
2.4.1 | 1,466 | 4/14/2020 | |
2.4.0 | 981 | 3/25/2020 | |
2.3.0 | 871 | 3/19/2020 | |
2.2.2 | 1,114 | 2/7/2020 | |
2.2.1 | 597 | 2/7/2020 | |
2.2.0 | 692 | 1/27/2020 | |
2.1.0 | 585 | 1/16/2020 | |
2.0.0 | 579 | 1/4/2020 | |
1.8.1 | 866 | 12/9/2019 | |
1.8.0 | 3,389 | 8/30/2019 | |
1.7.0 | 638 | 8/22/2019 | |
1.6.0 | 659 | 7/22/2019 | |
1.5.1 | 768 | 7/14/2019 | |
1.5.0 | 765 | 7/11/2019 | |
1.4.0 | 628 | 6/17/2019 | |
1.3.0 | 670 | 6/4/2019 | |
1.2.0 | 730 | 6/3/2019 | |
1.1.0 | 684 | 5/28/2019 | |
1.0.1 | 767 | 5/21/2019 | |
1.0.0 | 1,017 | 4/24/2019 | |
0.8.0 | 989 | 5/1/2019 | |
0.7.0 | 1,073 | 4/22/2019 | |
0.6.3 | 967 | 4/19/2019 | |
0.6.2 | 984 | 4/19/2019 | |
0.6.1 | 956 | 4/19/2019 | |
0.6.0 | 966 | 4/19/2019 | |
0.5.0 | 1,072 | 4/18/2019 | |
0.3.0 | 1,217 | 4/11/2019 | |
0.2.1 | 1,002 | 4/11/2019 | |
0.2.0 | 994 | 4/11/2019 | |
0.1.0 | 1,099 | 4/10/2019 |