AvroSharp.Confluent
1.1.0
dotnet add package AvroSharp.Confluent --version 1.1.0
NuGet\Install-Package AvroSharp.Confluent -Version 1.1.0
<PackageReference Include="AvroSharp.Confluent" Version="1.1.0" />
<PackageVersion Include="AvroSharp.Confluent" Version="1.1.0" />
<PackageReference Include="AvroSharp.Confluent" />
paket add AvroSharp.Confluent --version 1.1.0
#r "nuget: AvroSharp.Confluent, 1.1.0"
#:package AvroSharp.Confluent@1.1.0
#addin nuget:?package=AvroSharp.Confluent&version=1.1.0
#tool nuget:?package=AvroSharp.Confluent&version=1.1.0
AvroSharp.Confluent
Confluent Schema Registry serializers and deserializers for Confluent.Kafka, built on AvroSharp, without Apache.Avro.
Types:
- types generated from
.avscfiles; - your own C# types marked
[AvroSerializable]; - generic records (
AvroValue); - the primitives
string,int,long,float,double,boolandbyte[], and Confluent.Kafka'sNull, as in Confluent's serializers.
- types generated from
Confluent's own code for the registry: AvroSharp's serializers derive from Confluent's serializer base classes, so these work as in Confluent's serializer:
- subject name strategies;
- registration and
use.latest.version; - schema ID strategies (prefix or header);
- schema references;
- data contract rules: domain rules (such as CEL, which names the Avro fields, as Java's serializer does), encoding rules, migration rules (JSONata) and field rules, such as field-level encryption (CSFLE) and
CEL_FIELD.
Only the Avro encoding is AvroSharp's. With
use.latest.versionoruse.schema.id, the serializer also checks that the target schema encodes as your type's, logical types included, which Confluent's doesn't.Interchangeable with Confluent's serializer:
- the same message bytes for the same schema and value;
- the same configuration keys (
avro.serializer.*,avro.deserializer.*); - each reads what the other writes. The tests compare them byte for byte.
Schema evolution: a message is read in its writer's schema, from the registry by its schema ID, and resolved to your type's schema, so older and newer versions both read.
Status: new in 1.0.0, and released with AvroSharp at the same version. It follows semantic versioning with the rest of AvroSharp.
Guide · API reference · Sample · AvroSharp documentation
Install
dotnet add package AvroSharp.Confluent
dotnet add package AvroSharp.Generators
AvroSharp.Generators turns your .avsc files and [AvroSerializable] types into C# code while the project builds (see code generation). AvroSharp.Confluent depends on Confluent.SchemaRegistry 2.14.0 or later (below 3.0). The tests run against 2.14.0 and the newest release.
Use
using AvroSharp.Confluent;
using Confluent.Kafka;
using Confluent.SchemaRegistry;
using var registry = new CachedSchemaRegistryClient(new SchemaRegistryConfig { Url = "http://localhost:8081" });
// Order is generated from Order.avsc, or is a partial class marked [AvroSerializable].
using var producer = new ProducerBuilder<string, Order>(new ProducerConfig { BootstrapServers = "localhost:9092" })
.SetAvroSharpKeySerializer(registry)
.SetAvroSharpValueSerializer(registry)
.Build();
await producer.ProduceAsync("orders", new Message<string, Order> { Key = order.Id.ToString(), Value = order });
using var consumer = new ConsumerBuilder<string, Order>(new ConsumerConfig { BootstrapServers = "localhost:9092", GroupId = "billing" })
.SetAvroSharpKeyDeserializer(registry)
.SetAvroSharpValueDeserializer(registry)
.Build();
The guide has:
- generic records;
- several record types on one topic;
- .NET Standard;
- the settings and their Confluent keys;
- moving from Confluent's Avro serializer and from Chr.Avro;
- tombstones and the other behaviors to know;
- which data contract rules run.
| Product | Versions 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 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. net11.0 is compatible. |
| .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
- AvroSharp (>= 1.1.0)
- Confluent.SchemaRegistry (>= 2.14.0 && < 3.0.0)
- System.Diagnostics.DiagnosticSource (>= 8.0.1)
-
net10.0
- AvroSharp (>= 1.1.0)
- Confluent.SchemaRegistry (>= 2.14.0 && < 3.0.0)
-
net11.0
- AvroSharp (>= 1.1.0)
- Confluent.SchemaRegistry (>= 2.14.0 && < 3.0.0)
-
net8.0
- AvroSharp (>= 1.1.0)
- Confluent.SchemaRegistry (>= 2.14.0 && < 3.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AvroSharp.Confluent:
| Package | Downloads |
|---|---|
|
AvroSharp.KafkaFlow
KafkaFlow serializers and deserializers for Confluent Schema Registry on AvroSharp: generated and [AvroSerializable] types, several types per topic, the same bytes as KafkaFlow's Confluent Avro serializer. No Apache.Avro. |
GitHub repositories
This package is not used by any popular GitHub repositories.