Class SchemaRegistryMessageSerializer<TMessage>
Connects to the specified schema registry and deserializes the messages.
Inheritance
SchemaRegistryMessageSerializer<TMessage>
Implements
Inherited Members
Namespace: Silverback.Messaging.Serialization
Assembly: Silverback.Integration.Kafka.SchemaRegistry.dll
Syntax
public abstract class SchemaRegistryMessageSerializer<TMessage> : IMessageSerializer where TMessage : class
Type Parameters
| Name | Description |
|---|---|
| TMessage | The type of the messages to be serialized. |
Constructors
SchemaRegistryMessageSerializer(ISchemaRegistryClient, IAsyncSerializer<TMessage>)
Initializes a new instance of the SchemaRegistryMessageSerializer<TMessage> class.
Declaration
protected SchemaRegistryMessageSerializer(ISchemaRegistryClient schemaRegistryClient, IAsyncSerializer<TMessage> confluentSerializer)
Parameters
| Type | Name | Description |
|---|---|---|
| ISchemaRegistryClient | schemaRegistryClient | The schema registry client. |
| IAsyncSerializer<TMessage> | confluentSerializer | The Confluent serializer to be used to serialize the message. |
Properties
SchemaRegistryClient
Gets the schema registry client.
Declaration
public ISchemaRegistryClient SchemaRegistryClient { get; }
Property Value
| Type | Description |
|---|---|
| ISchemaRegistryClient |
Methods
SerializeAsync(object?, MessageHeaderCollection, ProducerEndpoint)
Serializes the specified message object into a byte array.
Declaration
public ValueTask<Stream?> SerializeAsync(object? message, MessageHeaderCollection headers, ProducerEndpoint endpoint)
Parameters
| Type | Name | Description |
|---|---|---|
| object | message | The message object to be serialized. |
| MessageHeaderCollection | headers | The message headers collection. |
| ProducerEndpoint | endpoint | The endpoint. |
Returns
| Type | Description |
|---|---|
| ValueTask<Stream> | A Task<TResult> representing the asynchronous operation. The task result contains the Stream with the serialized message. |