MQContract.Kafka
3.9.2
dotnet add package MQContract.Kafka --version 3.9.2
NuGet\Install-Package MQContract.Kafka -Version 3.9.2
<PackageReference Include="MQContract.Kafka" Version="3.9.2" />
<PackageVersion Include="MQContract.Kafka" Version="3.9.2" />
<PackageReference Include="MQContract.Kafka" />
paket add MQContract.Kafka --version 3.9.2
#r "nuget: MQContract.Kafka, 3.9.2"
#:package MQContract.Kafka@3.9.2
#addin nuget:?package=MQContract.Kafka&version=3.9.2
#tool nuget:?package=MQContract.Kafka&version=3.9.2
<a name='assembly'></a>
MQContract.Kafka
Contents
- Connection
- MissingSchemaException
- PersistenceFailedException
- SchemaValidationFailedException
- SchemaValidationMiddleware
- UnableToPingException
<a name='T-MQContract-Kafka-Connection'></a>
Connection type
Namespace
MQContract.Kafka
Summary
This is the MessageServiceConnection implementation for using Kafka
<a name='M-MQContract-Kafka-Connection-#ctor-Confluent-Kafka-ClientConfig-'></a>
#ctor(clientConfig) constructor
Summary
Default Constructor
Parameters
| Name | Type | Description |
|---|---|---|
| clientConfig | Confluent.Kafka.ClientConfig | The Kafka Client Configuration to provide |
<a name='P-MQContract-Kafka-Connection-ClientConfig'></a>
ClientConfig property
Summary
Houses the supplied client configuration
<a name='T-MQContract-Kafka-MissingSchemaException'></a>
MissingSchemaException type
Namespace
MQContract.Kafka
Summary
Thrown when the service is unable to find a schema for a given message and it is set to fail when missing
<a name='T-MQContract-Kafka-PersistenceFailedException'></a>
PersistenceFailedException type
Namespace
MQContract.Kafka
Summary
Thrown when a publish message fails to persist in the system
<a name='T-MQContract-Kafka-SchemaValidationFailedException'></a>
SchemaValidationFailedException type
Namespace
MQContract.Kafka
Summary
Thrown when the content of a message fails to validate against the schema
<a name='T-MQContract-Kafka-Middleware-SchemaValidationMiddleware'></a>
SchemaValidationMiddleware type
Namespace
MQContract.Kafka.Middleware
Summary
Used to inject a confluent schema registry validation middleware that will use the confluent style schema registry to validate message types and attach schema information to each message
Parameters
| Name | Type | Description |
|---|---|---|
| schemaRegistryClient | T:MQContract.Kafka.Middleware.SchemaValidationMiddleware | A schema registry client used to validate messages |
<a name='M-MQContract-Kafka-Middleware-SchemaValidationMiddleware-#ctor-Confluent-SchemaRegistry-ISchemaRegistryClient,Microsoft-Extensions-Caching-Memory-IMemoryCache,System-Boolean,System-Boolean,Confluent-SchemaRegistry-SchemaType,System-Func{System-Type,System-String,System-String,System-Threading-Tasks-ValueTask{System-String}},System-Func{System-Type,System-Threading-Tasks-ValueTask{System-String}},System-Func{Confluent-SchemaRegistry-Schema,System-IO-Stream,System-Threading-Tasks-ValueTask{System-Boolean}}-'></a>
#ctor(schemaRegistryClient,cache,failOnMissingSchema,autoRegisterSchema,registerSchemaType,mapMessageSchemaName,extractSchemaAsync,validateSchemaAsync) constructor
Summary
Used to inject a confluent schema registry validation middleware that will use the confluent style schema registry to validate message types and attach schema information to each message
Parameters
| Name | Type | Description |
|---|---|---|
| schemaRegistryClient | Confluent.SchemaRegistry.ISchemaRegistryClient | A schema registry client used to validate messages |
| cache | Microsoft.Extensions.Caching.Memory.IMemoryCache | A memory cache to be used to cache resolved schemas if desired |
| failOnMissingSchema | System.Boolean | Indicates if the message should fail when no schema is available |
| autoRegisterSchema | System.Boolean | Indicates if the system should attempt to register a schema when one is not found on the publish side |
| registerSchemaType | Confluent.SchemaRegistry.SchemaType | The default schema registration type to use when registering a schema |
| mapMessageSchemaName | System.Func{System.Type,System.String,System.String,System.Threading.Tasks.ValueTask{System.String}} | A callback used to change the schema name for a given message, by default it will use the MessageTypeID. The arguments pass will be the type (class) of the message, the topic and the message type id and is expecting a string with for the schema identifier. |
| extractSchemaAsync | System.Func{System.Type,System.Threading.Tasks.ValueTask{System.String}} | An alternative call to generate the schema for a given message type, otherwise NJsonSchema will be used |
| validateSchemaAsync | System.Func{Confluent.SchemaRegistry.Schema,System.IO.Stream,System.Threading.Tasks.ValueTask{System.Boolean}} | An alternative call to validate the schema and the incoming message content, otherwise it will default through NJsonSchema |
<a name='T-MQContract-Kafka-UnableToPingException'></a>
UnableToPingException type
Namespace
MQContract.Kafka
Summary
Thrown when the Connection is unable to obtain the Broker MetaData to create a PingResponse
| 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 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. |
-
net10.0
- Confluent.Kafka (>= 2.13.2)
- Confluent.SchemaRegistry (>= 2.13.2)
- MQContract.Abstractions (>= 3.9.2)
- NJsonSchema (>= 10.9.0 && < 12.0.0)
-
net8.0
- Confluent.Kafka (>= 2.13.2)
- Confluent.SchemaRegistry (>= 2.13.2)
- MQContract.Abstractions (>= 3.9.2)
- NJsonSchema (>= 10.9.0 && < 12.0.0)
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 |
|---|---|---|
| 3.9.2 | 121 | 3/26/2026 |
| 3.9.1 | 109 | 3/18/2026 |
| 3.9.0 | 110 | 3/1/2026 |
| 3.8.0 | 116 | 2/26/2026 |
| 3.7.0 | 113 | 2/22/2026 |
| 3.6.0 | 131 | 2/6/2026 |
| 3.5.2 | 126 | 1/27/2026 |
| 3.5.1 | 121 | 1/22/2026 |
| 3.5.0 | 116 | 1/20/2026 |
| 3.4.0 | 125 | 1/13/2026 |
| 3.3.0 | 128 | 11/29/2025 |
| 3.2.0 | 190 | 11/28/2025 |
| 3.1.1 | 162 | 11/23/2025 |
| 3.1.0 | 424 | 11/20/2025 |
| 3.0.0 | 416 | 11/17/2025 |
| 2.11.0 | 236 | 11/4/2025 |
| 2.10.0 | 154 | 10/31/2025 |
| 2.9.0 | 130 | 10/18/2025 |
| 2.8.1 | 191 | 10/16/2025 |
| 2.8.0 | 187 | 8/17/2025 |