Class SchemaRegistryMessageDeserializer<TMessage>
- Namespace
- Silverback.Messaging.Serialization
- Assembly
- Silverback.Integration.Kafka.SchemaRegistry.dll
Connects to the specified schema registry and deserializes the messages.
public abstract class SchemaRegistryMessageDeserializer<TMessage> : IMessageDeserializer where TMessage : class
Type Parameters
TMessageThe type of the messages to be deserialized.
- Inheritance
-
SchemaRegistryMessageDeserializer<TMessage>
- Implements
- Derived
- Inherited Members
Constructors
SchemaRegistryMessageDeserializer(ISchemaRegistryClient, IAsyncDeserializer<TMessage>)
Initializes a new instance of the SchemaRegistryMessageDeserializer<TMessage> class.
protected SchemaRegistryMessageDeserializer(ISchemaRegistryClient schemaRegistryClient, IAsyncDeserializer<TMessage> confluentDeserializer)
Parameters
schemaRegistryClientISchemaRegistryClientThe schema registry client.
confluentDeserializerIAsyncDeserializer<TMessage>The Confluent deserializer to be used to deserialize the message.
Properties
RequireHeaders
Gets a value indicating whether this serializer (with the current configuration) needs the headers support to work properly.
public bool RequireHeaders { get; }
Property Value
SchemaRegistryClient
Gets the schema registry client.
public ISchemaRegistryClient SchemaRegistryClient { get; }
Property Value
- ISchemaRegistryClient
Methods
DeserializeAsync(Stream?, MessageHeaderCollection, ConsumerEndpoint)
Deserializes the byte array into a message object.
public ValueTask<DeserializedMessage> DeserializeAsync(Stream? messageStream, MessageHeaderCollection headers, ConsumerEndpoint endpoint)
Parameters
messageStreamStreamThe Stream containing the message to be deserialized.
headersMessageHeaderCollectionThe message headers collection.
endpointConsumerEndpointThe endpoint.
Returns
- ValueTask<DeserializedMessage>
A ValueTask<TResult> representing the asynchronous operation. The task result contains the deserialized message (or
nullwhen the input is null or empty) and the type of the message.
GetCompatibleSerializer()
Gets a new IMessageSerializer compatible with this deserializer.
public abstract IMessageSerializer GetCompatibleSerializer()
Returns
- IMessageSerializer
A new instance of an IMessageSerializer compatible with this deserializer.