DotPulsar.Extensions.Schemas
0.7.0
dotnet add package DotPulsar.Extensions.Schemas --version 0.7.0
NuGet\Install-Package DotPulsar.Extensions.Schemas -Version 0.7.0
<PackageReference Include="DotPulsar.Extensions.Schemas" Version="0.7.0" />
<PackageVersion Include="DotPulsar.Extensions.Schemas" Version="0.7.0" />
<PackageReference Include="DotPulsar.Extensions.Schemas" />
paket add DotPulsar.Extensions.Schemas --version 0.7.0
#r "nuget: DotPulsar.Extensions.Schemas, 0.7.0"
#:package DotPulsar.Extensions.Schemas@0.7.0
#addin nuget:?package=DotPulsar.Extensions.Schemas&version=0.7.0
#tool nuget:?package=DotPulsar.Extensions.Schemas&version=0.7.0
DotPulsar Schema Extensions
Provides support for using Json and ProtoBuf producers, consumers, and receivers.
It is important to note that this library does not use the official Pulsar Schema Registry. The types provided are merely for convenience on top of the existing Schema.ByteSequence schema.
DotPulsar library recently released official support for Json and Protobuf messages that use the official Pulsar Schema Registry. Consider migrating to the latest version.
Installation
dotnet add package DotPulsar.Extensions.Schemas
Usage
A JSON schema can be created using JsonByteSchema.Get<T>(). This schema can be used to create a producer, consumer, or receiver.
await using var producer = client.NewProducer(JsonByteSchema.Get<YourType>())
.Topic("persistent://public/default/my-topic")
.Create();
Custom serialization options can be passed into the constructor new JsonByteSchema<T>(options) or by overriding the default options using JsonByteSchema.DefaultSerializerOptions.
Native AOT and trimming
The JsonSerializerOptions-based APIs rely on reflection and are annotated with RequiresUnreferencedCode/RequiresDynamicCode. For trimmed or native AOT applications, use the overloads that accept a source-generated JsonTypeInfo<T> instead:
[JsonSerializable(typeof(YourType))]
internal partial class MyJsonContext : JsonSerializerContext;
await using var producer = client.NewProducer(JsonByteSchema.Get(MyJsonContext.Default.YourType))
.Topic("persistent://public/default/my-topic")
.Create();
// or
await using var consumer = client.NewJsonConsumer(MyJsonContext.Default.YourType)
.SubscriptionName("my-subscription")
.Topic("persistent://public/default/my-topic")
.Create();
The same can be done for Protobuf schemas using ProtobufByteSchema.Get<T>().
await using var producer = client.NewProducer(ProtobufByteSchema.Get<YourType>())
.Topic("persistent://public/default/my-topic")
.Create();
Both JsonByteSchema and ProtobufByteSchema support passing a custom ISchema<ReadOnlySequence<byte>> schema. This allows for custom handling of the bytes that are sent and received. One potential use case would be to implement custom encryption or compression of the message bytes.
License
This project is licensed under Apache License, Version 2.0.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 is compatible. 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. |
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.7.0 | 96 | 11/10/2026 |
| 0.6.0 | 20,892 | 3/9/2026 |
| 0.5.1 | 7,767 | 11/12/2025 |
| 0.5.0 | 390 | 11/11/2025 |
| 0.3.1 | 9,050 | 3/31/2025 |
| 0.3.0 | 321 | 3/11/2025 |
| 0.2.4 | 1,575 | 2/21/2025 |
| 0.2.3 | 257 | 2/20/2025 |
| 0.2.2 | 1,470 | 2/6/2025 |
| 0.2.1 | 2,077 | 9/3/2024 |
| 0.2.0 | 325 | 7/30/2024 |
| 0.1.0 | 277 | 7/15/2024 |
| 0.0.9 | 268 | 7/15/2024 |
| 0.0.8 | 317 | 7/10/2024 |
| 0.0.7 | 284 | 7/9/2024 |
| 0.0.6 | 250 | 7/9/2024 |
| 0.0.5 | 392 | 6/12/2024 |
| 0.0.3 | 263 | 6/12/2024 |
| 0.0.2-rc.1 | 237 | 3/7/2024 |